Ask Your Question

Revision history [back]

medianBlur on ROI not correct at top and bottom

I've noticed that the medianBlur function gives different results for the top and bottom lines of a region-of-interest depending on whether the whole image is filtered (and then the ROI extracted), or just the ROI is filtered (by passing an input image with ROI defined). Looking at the source code, there is a call to:

cv::copyMakeBorder( src0, src, 0, 0, ksize/2, ksize/2, BORDER_REPLICATE );

where the top/bottom arguments are passed as zero. This seems to imply that the filter doesn't consider areas outside the top/bottom of the ROI, which I don't understand.

Is this the intended behavior of the medianBlur filter? I wasn't able to find anything in the documentation that indicates that this is how it should work.