From CUVI Wiki

Applies 2D median filter to the input image


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


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



//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);