Last updated: 29 November 2024

How to use OpenCV to automate component inspection

In production processes, it is very important to ensure quality. In many cases, this is still done with the human eye, which can cause problems afterwards. We see more and more companies making the switch to machine vision in quality control and other production processes. In this article, we explain an application where machine vision is used in combination with OpenCV software to inspect semi-finished products. Of course, analysis of products can also be done with other software programs, but in this particular case we will elaborate on the possibilities with OpenCV.

How to use OpenCV to automate component inspection

 

Introducing OpenCV for Industrial Applications

OpenCV (Open Source Computer Vision Library) is a versatile and widely-used software library for computer vision and machine learning. It offers a comprehensive set of tools and algorithms that can be applied to various industrial inspection tasks. Some key features of OpenCV include:

  • Over 2500 optimized algorithms for image processing and analysis
  • Support for multiple programming languages including Python, C++, and Java
  • Cross-platform compatibility (Windows, Linux, macOS, Android)
  • Active community support and regular updates

Machine vision application

We received an inquiry for a machine vision set up where the customer wanted to recognize, locate and measure products so that the product would be ready for the next manufacturing step. We followed 4 steps to choose the right setup for his application:

Industrial Camera for automated inspection of components

The camera needed to hang at about 3300mm distance right above the product. When the camera takes the images of the product the customer wanted to then process them with OpenCV. The product was about 700x700mm and wanted to be able to see small details of 3x3mm. The idea was to eventually visualize a larger area, namely 3000x2000mm to be able to process multiple products at once. Given these specifications, a machine vision camera with at least 3000 x 2000 pixels is required. A camera that meets these requirements is a 12MP USB3.0 ‘MER2-1220-32U3C’ camera.

Machine vision lens for IMX226

The customer indicated in their request that they would prefer a set up with a telecentric lens. We typically recommend to customers that if your field of view is larger than 65 x 50 mm, it is better to use a standard C-mount lens. In addition, a telecentric lens has a fixed working distance and can only be focused on that working distance.

The next step is to calculate an appropriate industrial lens for the camera.  To calculate this, we use the lens calculator on our website. See below for a screenshot of our lens calculator:

The lens calculator shows that we need an 8mm C-mount lens. A good option would therefore be this LCM-10MP-08MM-F2.8-1.5-ND1.

Machine vision lighting to automate component inspection

A complete set up is not complete without adding additional machine vision lighting. The customer indicated in their request that they themselves were thinking about a ring light. In many cases a ring light is a good option as lighting but in this particular case there is a better alternative. Given the relatively high working distance (3300 mm), too much light may be lost when using a ring light. It would therefore be better to use two of our new LED spotlights.

Recently, VA Imaging released a new LED spotlight. The LED spot has interchangeable optical lenses and is available in an opening angle of 90, 60 and 30 degrees. So, you can illuminate objects in a better way than with normal LED’s.

Main benefits of this LED spot:

  • Versatile solution with 90degree, 60degree and 30degree optical lenses
  • Compact design
  • IP67 rated
  • Optical illumination due to high efficiency LEDs

More information about this LED spot can be found on our website.

OpenCV Software

The machine vision camera needs to be controlled with our Software Development Kit. This SDK is free to download from the download page. The SDK contains programming examples and a user interface to easily set parameters of the camera.

The customer already indicated at the time of application that they wanted to use OpenCV software. OpenCV is an open-source machine vision software library with a widely used infrastructure that can be used with several applications. More information on how to download 3D party software for our machine vision cameras can be found in this article from our knowledge center: How to install USB3 – GigE industrial cameras with 3rd party software.

The OpenCV library has more than 2500 algorithms that can be used for:

- Object identification

- Tracking camera movements

- Create 3D models of objects

- Compare images

- Etc.

OpenCV has Python, C++, Java and MATLAB interfaces and supports Android, Windows, Linux and Mac OS.

Questions?

With the right combination of hardware and software, you can revolutionize your quality control processes and drive continuous improvement in your production line. If you have any further questions about the possibilities that machine vision can offer your application or would like to learn more about the capabilities of OpenCV software, please do not hesitate to contact us using the contact form below.

Our engineers will be happy to help you!