Back to previous page

Some academic and extracurricular projects

Monocular computer vision for metal-block centering on a CNC gripper

May 16th, 2024

I was contacted by an Italian metal-forming company to develop a computer vision system capable of determining whether a metal block was correctly centered between two bolts of a CNC gripper using a single camera.

A CNN only locates the block's corners and the two bolts, and projective geometry computes how far the block is displaced and in which direction. Music: original score made for this video. Sound effects: Kenney (CC0). Visuals include public project validation media.

I extended the original requirement beyond a simple aligned/misaligned classification. Using principles of projective geometry, I developed a method that estimates the degree of misalignment as a percentage. This percentage says much more than a yes/no answer and lets the system recalibrate itself with little human intervention.

The processing pipeline begins with a neural network that detects characteristic corners defining the position and orientation of the metal block, together with the two bolts used as alignment references. Based on these detected points, a geometric formulation projects the observed block position to estimate its desired centered location, shown in blue in the visualizations. I developed the geometric formulation myself from scratch, using concepts from projective geometry and without help from LLMs.

The images below show the performance of the system on photographs collected directly from the production environment at the factory.

Computer vision shift estimation on factory photograph 1 of a metal block held by a CNC gripper
Computer vision shift estimation on factory photograph 2 of a metal block held by a CNC gripper
Computer vision shift estimation on factory photograph 3 of a metal block held by a CNC gripper
Computer vision shift estimation on factory photograph 4 of a metal block held by a CNC gripper
Computer vision shift estimation on factory photograph 5 of a metal block held by a CNC gripper
Computer vision shift estimation on factory photograph 6 of a metal block held by a CNC gripper
Computer vision shift estimation on factory photograph 7 of a metal block held by a CNC gripper
Computer vision shift estimation on factory photograph 8 of a metal block held by a CNC gripper
Computer vision shift estimation on factory photograph 9 of a metal block held by a CNC gripper
Computer vision shift estimation on factory photograph 10 of a metal block held by a CNC gripper
Computer vision shift estimation on factory photograph 11 of a metal block held by a CNC gripper
Computer vision shift estimation on factory photograph 12 of a metal block held by a CNC gripper
Computer vision shift estimation on factory photograph 13 of a metal block held by a CNC gripper
Computer vision shift estimation on factory photograph 14 of a metal block held by a CNC gripper
System performance on some of the images collected at the factory. The blue overlay represents the estimated desired centered position of the metal block, while red indicates a shift to the left of the target position and green a shift to the right.

To evaluate the complete pipeline on video, I also built a physical mockup reproducing the relevant geometry of the two reference bolts. This allowed me to test the CNN-based corner detection, the computation of the desired block position, and the vision-based estimation of the displacement between the current and target positions on recorded videos of the mockup, with the inference running on a Jetson Nano. Two examples of these experiments are shown below.

Shift estimation of a metal block on a recorded video of a physical mockup, first example
Shift estimation of a metal block on a recorded video of a physical mockup, second example
Demonstration of the computer vision system estimating the shift on recorded videos of a geometrically similar physical mockup. The second video was compressed to reduce its size, which caused a slight loss of quality.

The prototype was successfully developed and validated using the dataset collected at the Italian factory. I did not continue with the deployment of the project because I moved to Prague to start studying my master's degree.