Filters have various applications in image processing and machine vision. By using filters, we can reduce image noise, improve image quality, highlight defects, adjust brightness, resize images, and much more. In implementing a [machine vision system], different types of these filters can be employed for quality control using cameras. This article introduces 10 important applications of image processing filters in machine vision projects.
Download the Implementation Program of 10 Filters in Halcon Image Processing Software
The images in this article are related to examples implemented in the machine vision training course using the powerful Halcon software . To download the code related to the implementation of these filters, simply enter your information in the form below, and the download link will be sent to you. Watch the video for details about this program.
To run the codes, you need to download and install Halcon software first.
1- Edge Detection with Image Processing Filters
In image processing, changes in pixel intensity create edges. Edge detection is a commonly used filter in image processing, employed in many machine vision algorithms such as object recognition and measurement. For example, in the image below, products are identified using edge detection in conjunction with object recognition algorithms.
2- Defect Highlighting
Image processing filters can be used to highlight defects in an image. In the example below, the use of a median filter highlights defects in the image.
By applying thresholding to the filtered image, defects can be easily identified, as shown in the figure below.
3- Image Segmentation
Image segmentation involves dividing the image into multiple regions. The use of filters can aid in image segmentation. For instance, consider the goal of reading letters and numbers in the following image. To achieve this, we first need to find the regions containing letters and numbers in the image (segment the image). For this purpose, we can initially filter the image using a median filter as shown below.
Now, in the filtered image, we can easily identify the regions of numbers using thresholding.
4- Structure Removal
Certain structures in an image can hinder the development of our intended program. Image processing filters can help remove these structures. For example, in the image below, using a median filter allows us to remove the structure and present the image as shown.
5- Noise Reduction
Noise on an image can negatively impact the performance of many image processing algorithms. For noise reduction in image processing, median and average filters are commonly used. Note that in machine vision, noise in the image can often be mitigated through [illumination](https://www.visionsystems.ir/machine-vision-lighting/). In the image below, noise reduction using a filter is demonstrated.
6- Brightness Enhancement
Enhancing the brightness of an image can help improve it before implementing a specific algorithm. For example, in the image below, brightness is improved using a correction filter.
7- Color Image Conversion
Many image processing and machine vision algorithms work with black and white images. Therefore, there is often a need to convert color images to black and white before using these algorithms. For instance, in the image below, we convert the color image to black and white.
In the black and white image, we can identify the position of the cheese package.
Finally, using the [object identification algorithm](https://www.visionsystems.ir/matching_algorithm_image_processing/), we check the number of different cheese flavors and display the results on the color image.
8- Image Quality Improvement
Image processing filters can improve the quality of an image. For example, in the image below, applying thresholding improves the image quality, and its colors are corrected.
9- Gray Value Adjustment
In some cases, we need to adjust gray values so that white parts of the image become black, and vice versa. For instance, in the image below, before implementing an [OCR algorithm](https://www.visionsystems.ir/machine-vision-ocr-optical-character-recognition/), we perform this adjustment.
10- Image Size Reduction
The performance speed of image processing code usually depends on the image size. Larger images result in slower performance. Depending on our needs, we can increase the speed of our code by reducing the image size. However, we must be careful not to compromise the accuracy of our program by reducing the image size. For example, in the detection of diaper defects to check the presence or absence of the water-absorbing pad (green rectangular shape in the center of the diaper), the image size has been reduced.
Conclusion
This article introduced 10 important applications of image processing filters that can be helpful in machine vision projects. The implementation of these filters in the Halcon software for solving various machine vision projects has been covered in the training course.