Function:MedianFilter

From CUVI Wiki
Jump to: navigation, search

Applies 2D median filter to the input image

Function

CuviStatus medianFilter(const CuviImage& src,
                        CuviImage& dst,
                        const CuviRect& roi,
                        const CuviSize& filterSize,
                        const CuviStream& stream = CuviStream());

Parameters

Name Type Description
src const CuviImage& Input Image
dst CuviImage& Output Image
roi const CuviRect& Region of Interest
filterSize const CuviSize& Median filter's kernel size. Only 3x3, 5x5, 7x7, and 9x9 are supported
stream const CuviStream& GPU stream ID for execution

Image Type Support

Input Output
8uC1 8uC1
8uC3 8uC3


Sample

Example

//Input image
CuviImage gimg = cuvi::io::loadImage(path);
 
//Output Image
CuviImage gout;
 
//Choosing ROI
CuviRect roi(0,0,img.width(),img.height());
 
//Filter Size
CuviSize  fSize(5,5);
 
//Applying Median filter of size 5x5 on the image
cuvi::imageFiltering::medianFilter(gimg, gout, roi, fSize);