Image Smoothing vTool#
Image smoothing is a preprocessing step to reduce image noise. Another use case would be to produce an image containing only the background of the original image by removing all thin structures if you use a large enough filter mask.
The Image Smoothing vTool accepts an image via the Image input pin and outputs the filtered image via the Image output pin.
If you use the ROI Creator vTool to specify a region of interest before smoothing, the Image Smoothing vTool accepts the ROI data via its Roi input pin. In that case, smoothing is only performed on the region of interest which results in faster processing.
Image Smoothing vTool Versions#
Two versions of the Image Smoothing vTool are available. The following table shows the differences between the versions. Click a version in the table heading to jump directly to the relevant section in this topic.
Starter | Basic | |
---|---|---|
Which smoothing operations are available? | Mean, Gaussian | Mean, Binomial |
Valid data types for Roi input pin | RectangleF | RectangleF, RectangleF Array, Region, Region Array |
How It Works#
The Image Smoothing vTool offers two standard filter operations:
- Mean filtering
- Binomial filtering (Basic version only)
- Gaussian filtering (Starter version only)
Mask Shapes#
Both operations use a rectangular mask with a specified width and height. Only odd values are allowed. This ensures that the mask always has a center pixel. The corresponding pixel in the output image will receive the gray value that is the result of the filtering operation.
If you open the settings dialog for the first time, width and height are linked. This means that you can change both parameters at the same time and the resulting mask will be square. You can also set width and height separately. To do this, click the chain icon to break the link between width and height.
- Options linked:
- Options unlinked:
Mean Filtering#
The mean filter is a very efficient filter because of its speed even for large mask sizes. It calculates the average of the pixel gray values covered by the mask and applies this average value to the corresponding pixel at the center of the mask in the output image. All input pixels are weighted equally.
With a large mean filter, you can produce a kind of background image because small and sharp (high frequency) image structures are suppressed and big or smooth (low frequency) image structure are retained and stand out more clearly as a result.
By defining a very thin vertical or horizontal rectangular mask, you can emphasize vertical or horizontal image structures.
The maximum filter mask size is 1001 x 1001 pixels.
Binomial Filtering (Basic Version Only)#
The binomial filter is a good approximation of the Gaussian filter, which is the ideal low-pass filter. Use the binomial filter for optimum smoothing results. Its execution takes a bit longer than the mean filter.
The mask used for binomial filtering assigns different weights to the pixels covered by the mask. These weights are derived from the binomial coefficients. The center pixel of the filter mask has the highest weight. The weights of the other pixels gradually decrease to zero the closer the pixels are to the border of the mask.
The maximum filter mask size is 37 x 37 pixels.
Gaussian Filtering (Starter Version Only)#
The Gaussian filter is the ideal low-pass filter. Use this for optimum smoothing results. Its execution takes a bit longer than the mean filter.
Each pixel in the image is replaced by a weighted average of its neighboring pixels. The weights are determined by a Gaussian distribution, which is a mathematical function that gives higher weight to pixels closer to the center of the neighborhood and lower weight to pixels farther away. This weighted averaging process effectively smooths out the image by reducing high-frequency noise and sharp transitions between pixels.
The maximum filter mask size is 37 x 37 pixels.
Image Smoothing Starter#
Configuring the vTool#
To configure the Image Smoothing Starter vTool:
- In the Recipe Management pane in the vTool Settings area, click Open Settings or double-click the vTool.
The Image Smoothing Starter dialog opens. - In the Smoothing Operation area, select the desired operation.
- Link/unlink the Width and Height options as required.
- Specify the width and height of the filter mask.
You can view the result of the smoothing in a pin data view.
Image Smoothing Basic#
Configuring the vTool#
To configure the Image Smoothing Basic vTool:
- In the Recipe Management pane in the vTool Settings area, click Open Settings or double-click the vTool.
The Image Smoothing Basic dialog opens. - In the Smoothing Operation area, select the desired operation.
- Link/unlink the Width and Height options as required.
- Specify the width and height of the filter mask.
You can view the result of the smoothing in a pin data view.
Inputs#
Image#
Accepts images directly from a Camera vTool or from a vTool that outputs images, e.g., the Image Format Converter vTool.
- Data type: Image
- Image format: 8-bit to 16-bit mono or color images (see Supported Pixel Formats)
Roi#
Accepts a region of interest from the ROI Creator vTool or any other vTool that outputs regions or rectangles. Multiple rectangles or regions are merged internally to form a single region of interest. The Starter version accepts only RectangleF.
- Data type: RectangleF, RectangleF Array, Region, Region Array
Outputs#
Image#
Returns the filtered image. The output image can be used by any vTool accepting images as input.
- Data type: Image
- Image format: Color or mono images (see Supported Pixel Formats)
Supported Pixel Formats#
Depending on the pixel format of the input image, the Image Smoothing vTool outputs the following pixel formats:
Input Pixel Format | Output Pixel Format |
---|---|
Bayer GR 8 | RGB 8 Planar |
Bayer GR 16 | RGB 16 Planar |
Bayer RG 8 | RGB 8 Planar |
BGRA 8 Packed | RGB 8 Planar |
BGR 8 Packed | RGB 8 Planar |
Mono 8 | Mono 8 |
Mono 10 | Mono 10 |
Mono 12 | Mono 12 |
Mono 16 | Mono 16 |
RGB 8 Packed | RGB 8 Planar |
RGB 16 Packed | RGB 16 Planar |
RGB 8 Planar | RGB 8 Planar |
RGB 16 Planar | RGB 16 Planar |