MATLAB: How to apply confilt

digital image processingfilterimage analysis

I have image of 768 by 1024 pixels, I want to perform an order statistical filter (min and max) on it by employing confilt order with a 5 by 5 window OP = colfilt(IP, [5 5], 'sliding', @min); but I got this error message "??? Error using ==> reshape To RESHAPE the number of elements must not change.
Error in ==> colfilt at 183 b(i*mb+brows,j*nb+bcols) = …"

Best Answer

Don't use colfilt.
To get the local min
minImage = imerode(grayImage, ones(5));
To get the local max
maxImage = imdilate(grayImage, ones(5));
To get the local max-min
rangeImage = rangefilt(grayImage, ones(5));
Related Question