As part of my independent study in computer vision and machine learning, I developed a vision-based countersink inspection tool using the OpenCV library and Python 3. To capture the images, a 5 MP digital microscope was connected to a Raspberry Pi 3 and a 7″ touch screen display. I proposed this project to my supervisor to help minimize the wasted motion of technicians who needed to verify setup parts in the quality department prior to running the batch. The total cost of the hardware was just over $200 and my time was considered free since this project was, after all, homework. I installed the inspection tool at the countersink station, and it has successfully reduced wasted motion by approximately 300%.
This inspection tool is fairly simple in that it doesn’t require any user operations besides placing the part within the view area of the microscope. The measurements are then displayed in real-time along with a message indicating whether or not the value conforms to acceptable ranges. One of the primary objectives of this project was to make it as user-friendly as possible, so slight adjustments to the information displayed have been made based on feedback from our technicians.
Having gained some familiarity with both Python 3 and OpenCV from my Aerial Lift Bridge project, I was able to incorporate the more technical knowledge gained from my course to provide an adaptable imaging and measurement solution for our company. The basic algorithm followed to achieve this is as follows:
- Read microscope stream
- Parse stream into individual frames
- Perform image operations to enhance desired features
- Detect edges
- Identify strongest contour
- Locate centroid and radius
- Draw a circle with those values
- Apply a pixel-to-inch conversion factor
- Determine status of conformity
- Display original images with relevant data overlaid
Some of the code that performs this algorithm can be seen below.
The inspection tool successfully measures countersink features with acceptable reliability. The Raspberry Pi proved to be an intuitive and appropriate platform for a project of this scale and the CPU provided adequate processing power for both video and image processing applications.
A duplicate image of the MicroSD card that holds the operating system has been provided to Hydrosolutions of Duluth should there be a data failure along with the full bill of materials shown above.
Some potential issues that may restrict the applications of this tool are:
- The ranges of values entered in the database account only for the most common types of fasteners used in this environment.
- The image processing techniques, though designed to be adaptable, may not accommodate certain surface finishes and lighting conditions.