In order to correct gradual changes of intensities in the background of grey-scales images, I have been blurring them and then subtracting the original images from the convolved one.

In some cases, I have seen improvement using median blur instead of blur.

I was therefore wondering if I could go further and use a filter that convolves a grey-scale image so that each pixel will take the value of the most represented pixel value in the histogram of a rectangular neighbourhood.

Do you know the name of this convolution ?

Are you aware of any implementation in OpenCV ?

Thank you very much,


1 Answer 1


This is a non-linear filter, the operation being performed is not a convolution and cannot be represented by a filter kernel. It is sometimes called a mode filter, by analogy to the median filter, since the value taken by a pixel is the mode of the distribution of the neighboring values. OpenCV does median filtering (cvSmooth with CV_MEDIAN parameter), I don't think it does mode filtering though.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.