VMS has the ability to perform several different types of image filters to help make measuring easier. This can be done using the filter_image(IMAGE InputImage, INTEGER FilterType, INTEGER Radius, IMAGE OutputImage) function. The parameters for the function are as follows:
- InputImage – The image on which the filter is going to be applied
- FilterType – The parameter that specifies which filter to use
- Radius – This is the size of the filter that is going to be applied to an image in pixels. For example, when running a smoothing filter with a radius of 5, this will average every pixel with all surrounding pixels within a 5-pixel radius.
- OutputImage – The filtered image.
There are 7 total filters that can be used with this function. Below are the 3 most commonly used ones and what they are used for.
Smoothing Filter
The smoothing filter runs a moving average filter over every pixel in an image. Every pixel is replaced with the average of its surrounding pixels. The size of the filter is specified by the radius parameter. The smoothing filter is especially useful when trying to eliminate noise in an image. The downside to this filter is that edges are smoothed out as well.
Median Filter
The median filter works similarly to the smoothing filter, but rather than replacing every pixel with the average of its surrounding pixels, it will replace it with the median value. This is especially useful for reducing sparse amounts of noise such as scratches. The median filter has the added benefit of usually preserving edges.
Contrast Filter
The contrast filter works by highlighting any areas in an image where there is a sharp edge. This filter is useful when attempting to highlight edges, especially when the intensity of the background is unknown or variable. This filter is also very useful for defect detection.
Future issues of The VIEW Vision will cover interesting topics such as off-axis sensors, feature constructions and fun with blobs. Let us know what topics you would like covered. Email your suggestions to applications@viewmm.com.