Laser Spot Alignment Vision
A webcam and a short Python program that answer an alignment question objectively: where is the center of the reference, where is the center of the laser spot, and how far apart are they? It takes a few hundred dollars of equipment at most, and it replaces a judgment call with a number.
The problem
People judge a laser spot's center by eye, and the eye is easily fooled by scatter and a bright, spread-out spot. Two observers can disagree, and neither leaves a record.
What I built
A system that locates a printed reference circle once, then repeatedly computes the laser spot's center, measures the offset, and gives an audible result while saving an annotated image of every decision.
The result
Pixel-level pass/fail against a ±12-pixel window on a 2304 × 1536 image. It stayed reliable with a bright television changing picture in the same frame.
The test setup
Everything is off the shelf. Click either photo to see it full size.


Aligned and misaligned, as the system sees them
The blue circle is the detected reference, the red dot is its center, and the small dot in the spot is the computed laser center.


From a camera frame to a measured offset
The setup
- Logitech C920 webcam, a laptop running Python, a printed circle pattern and a green laser pointer
- Colored plastic in front of the laser serves as an inexpensive neutral-density filter, so the spot doesn't saturate the camera
- The reference circle is found once and reused, and only the laser center is recomputed for each frame
What the testing showed
- A pixel counts as laser light only if its green value is high and both red and blue are below 70% of it. That simple rule, with the circle located first, held up with a changing television image in view
- In one sample the spot was within 7 pixels of center. In another it missed by 10 pixels in x and 13 in y, which correctly failed the window
- Scatter makes the computed center differ from where a person would put it. That's the point: the measurement is repeatable and documented, even when it disagrees with the eye
Objective alignment checks
- Optical bench and laser alignment verification
- Alignment of laser marking, cutting and measurement tools
- Automated pass/fail stations with an image record for quality
- A low-cost prototype before specifying a commercial beam profiler
For full beam-quality measurement, see Automated Beam-Quality Analysis.
Stack
Need a measurement instead of a judgment call?
Simple vision systems can often replace expensive instruments or subjective checks.
Start a conversation