MATLAB: Distinguishing between laser and light spots

image processingImage Processing Toolboxlaser spot detectionlight spots

I have an image where there is a laser spot in towards the top right corner that I want to be able to detect and find the centroid of. The image was taken in a mostly dark room with a webcam, but you can see some spots of light that were coming into the room from the outside in the image. Is there a way to detect the laser spot while avoiding the other light spots in the image. My overall goal is to be able to take other images with the camera and make sure that the correct spot is being detected even if there are spots from another light source in the image. Is there anything I can do to eliminate these spots, but keep the laser so that when I use regionprops or some other code it doesn't find the centroid of one of those spots?

Best Answer

Lasers having relatively narrowband spectra, the laser should be primarily represented in a particular channel, depending on its colour. The (assumed) white light would be represented in all channels in a distribution that the laser would not share. Relative differences between the three colour channels could allow you to distinguish the different sources. If it’s a grayscale image though, this approach would obviously not work.