MATLAB: Defining a minimum area of contours

areacontourImage Processing Toolbox

Hi,
We have some applications which generate contour of meteorological parameters but are finding with wind direction in particular that many of the contours are very thin and/or small and are unrealistic. This typically happens when the direction changes dramatically over a small area. We have tried blurring/smoothing the data but there is a limit to how far we can go.
So my question is, is there any way or does anyone know of any methods (blurring/filtering aside) with which to force the contouring algorithms to make the polygons conform to a minimum size or width??
Cheers

Best Answer

If you have the Image Processing Toolbox, you could run rangefilt():
J = rangefilt(I) returns the array J, where each output pixel contains the range value (maximum value − minimum value) of the 3-by-3 neighborhood around the corresponding pixel in the input image I.
You could take a histogram of that image to see how many places the range is high, meaning that there would be many contours crammed into a small, narrow region. Knowing that you could choose your contour levels appropriately.