c++opencvcomputer-visiondetectionsubpixel

Detect center of laser line with sub-pixel accuracy


I am developing a simple 'laser line' scanner using C++ and OpenCV. So far I can detect the center of the laser line with an accuracy of 1 pixel, so I have a starting point for a possible 'sub pixel' function/algorithm. (the laser line is approx. 15-20pixels wide)

Now I am interested into refining this to sub-pixel accuracy. I know OpenCV has some sub-pixel detection functions, but as far as I know these are only for detecting corners.

If anyone has any suggestions, I'd like to hear them.

Some information;


Solution

  • There are two basic methods that I have used with good results:

    A search for "subpixel laser fitting" returns several more recent results.

    On the practical side, pay close attention to saturation: your exposure time (or lens aperture) should ensure that your sensor won't saturate even when the beam hits the lightest portions of the object surface. Searching for a peak in an area where the signal has been clipped by saturation is obviously pointless.

    Focusing (and depth of field) are other areas to pay attention - a blurred image of the beam on the object surface will yield a biased peak.