Detect laser on shooting target

asked 2015-08-07 13:41:07 -0600

updated 2015-08-07 15:45:45 -0600

Hi. I building a laser shooting target. A photodiode detects the shot by its modulation, and a camera detects its position (during the 15ms it is on). Since im new to C++ and OpenCV, I just thought it would be better to ask for the ideal and simpler way to do my detection algorithm.

To begin with, the target is 17 cm by 17 cm, in which it has 10 rings, (from 1 to 11) and requires a precision of a tenth of ring. If I record at 60fps it should be fast enough (~16ms per frame), but is 320x240 enough (~2pixels per tenth of ring)? Does 640x480 become a bottleneck to my RPi (v2) ? (~4 pixels per tenth of ring)?

As an algorithm Im thinking about making a binary image to find the black contour of the target, by looking up the highest point, the lowest, sides, and making it an elipse. After calculating which zone is which value, begin recording a binary image looking for bright red spots. Whenever one is detected and the photodiode confirms, calculate its position.

Its this the correct, most efficient procedure that an amateur can do? Is 60 fps guaranteed not to miss the shots? (can 90fps be avoided)

Side question: The red looks "redish" in the camera. Is there any proper way to calibrate colors like there is to calibrate distortion (cheeseboard trick)?

Thanks

edit retag flag offensive close merge delete

Comments

VGA should be possible even at 90FPS and you only have to compute the difference to the last image to detect your point. You could even only compute the difference on a subset of the pixels (depending on the size of the laser dot) and just store the image if you think that there is a laser dot. You could then process the images even afterwards so that you don't have to work in real time.

FooBar gravatar imageFooBar ( 2015-08-07 15:55:07 -0600 )edit

@FooBar Thanks for the comment. OpenCV being low-level (well C++ is, sort of) means it only runs on a single core unless specifically programmed to create several threads, is that correct? Do you really think that 90 vga frames can be processed at a single core of a pi, every second? That seems like a lot of pixels for a small processor. (just making sure it is enough) The laser pointer is half centimeter wide, so should be fairly simple to detect since the target is 17 cm wide. Is it possible to do so in less than 100 ms without lots of optimizations? (the camera probably has a capture delay of some tens of ms, I think I read about it somewhere)

Make it an answer, I'll accept it, and start doing it ;)

claudiop gravatar imageclaudiop ( 2015-08-07 16:38:56 -0600 )edit

It can at least record at 90FPS and the task is rather small so you maybe should just try. I don't think that a tenth of a ring will be possible. If you have 10 rings, each ring has a width of about 1cm and if your dot is half that large, find the center with 1mm accuracy will be hard. Parallelizing the detection is really easy as you only evaluate local features (e.g. absolute brightness difference to template). If you use a Rpi 2, you already have four cores and it should be possible.

FooBar gravatar imageFooBar ( 2015-08-08 15:16:45 -0600 )edit