Ask Your Question

[SOLVED]Multiple Laser Detection : OPENCV + Qt

asked 2017-11-19 08:43:30 -0500

roahanramesh gravatar image

updated 2018-01-31 23:39:58 -0500

Hello, I have a project wherein I need to detect multiple lasers that are PWM controlled. I have 10 lasers each with unique pulse widths. The camera frame rate is 200fps.

I am doing the following .

a. Using Qt + QConcurrent - I am able to capture the frames b. Converted the Image to Greyscale, Applied Gaussian Blur and Threshold the image to get binary image. c. Currently I am using Hough Circles to detect the number of circles and transmit the X,Y and framenumber. d. I am curious as to how to proceed further to discern the lasers based on the pulse widths.

Looking forward to receiving your valuable inputs.

Thanks and Regards

edit retag flag offensive close merge delete



If you're successfully detecting the lasers, then that's the end of the OpenCV part of this, yeah? After this it's just data analysis, and that's always different for every problem. This isn't something we can help you with.

If you were having trouble getting good detections on the lasers or something like that, we can help, but not this.

Tetragramm gravatar imageTetragramm ( 2017-11-19 09:21:56 -0500 )edit

thanks for your reply. My main doubt was whether Hough Circles was the way to go. In an earlier thread posted, there is a comment on use of Kalman Filter with Hungarian method. I was wondering what would be the difference.

Specifically this comment by Foobar.

It will be hard to find 10 different colored lasers. Another source of information could be a timed pattern in the lasers. You could attach some Arduinos to the lasers and give each a different PWM-pattern. BonusPoints for time synchronized patterns. With this, each laser could use some kind of morse code to identify itself. So you need a tracking (Kalman with hungarian method as theodore proposed sounds perfect) and a good camera. A good camera

roahanramesh gravatar imageroahanramesh ( 2017-11-19 22:52:55 -0500 )edit

Ok, I'm starting to understand. So is the background dark, and the laser points bright? Or are both bright, and the lasers just a different color? Would there ever be anything else the same color?

Basically, is shape the only thing that lets you separate the lasers from the background? If so, then you should use the Hough Circles, otherwise, there's probably a better option.

Tetragramm gravatar imageTetragramm ( 2017-11-21 16:28:09 -0500 )edit

Hello, Thanks for your reply.

Yes, the background is dark, In fact the camera is a monochrome camera, fitted with a day light filter, so only IR signals are passed through, in the captured video, we are seeing just the laser dots and nothing else. I can share with you the video and the source code for your reference.

roahanramesh gravatar imageroahanramesh ( 2017-11-22 00:17:23 -0500 )edit

Well the video would certainly be helpful.

You should be fine just using a threshold and connected components to give you the locations of the dots. Much faster than Hough Circles.

For the rest, you need to track the locations of each laser, then figure out which is which, right?

The Kalman Filter with the Hungarian method is for the tracking the locations of each laser. It lets you track multiple objects and keep track of which is which.

Tetragramm gravatar imageTetragramm ( 2017-11-22 12:46:11 -0500 )edit

I apologize for the delay in my reply. Can you please provide me with an email, I will send the file to you.

roahanramesh gravatar imageroahanramesh ( 2017-11-25 08:28:38 -0500 )edit

Youtube or a filesharing site is more useful. Just put a link in your post, and anyone can help.

Tetragramm gravatar imageTetragramm ( 2017-11-25 14:04:59 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2018-01-31 23:39:42 -0500

roahanramesh gravatar image

Hello. Managed to Solve the issue.

The procedure i followed are as follows: -

a. Find contours of lasers b. When atleast one contour is detected we parse it to a Hungarian Algorithm that assigns each of the laser based on previous detection to a specific "bin" based on distance to the previous detection. c. The previous detection is updated based on the following criteria a. Number of contours on the current frame vs number of contours in the previous frames.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-11-19 08:43:30 -0500

Seen: 444 times

Last updated: Jan 31 '18