How to locate/track a high intensity laser pointer spot on a live video?

Hi,
I want to locate/track a high intensity laser pointer spot on a live video.
* A web camera with USB interface is connected to a PC running Fedora
Core 5 Linux (and optionally Windows XP pro). The camera is pointed to a wall which is used as the projection screen. * One red and one green laser pointers are pointed to the screen at pseudo random locations. Laser are activated randomly for a duration of 50-2000 milli second. * Intensity of the laser pointers' spots are significantly brighter then the any texture/image on the wall.
I want to locate the laser pointer spots (ie. find the X,Y position of the laser pointer spots) in image frame and track them at video frame rate.
I wonder if there is an open-source C/C++ code for Linux (and Windows) which can locate/track bright spots (option of selecting color would be even better) on a live color video from a USB web camera?
Regards,
Albert
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

OpenCV's lukas-kanade tracker might be useful for tracking point features. See lkdemo.c in the samples directory after downloading opencv sources.
VKC
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Albert Goodwill wrote:

I used to work at a place that did that but we did it in hardware. Stopping the video camera way down or putting a filter in front to cut the general illumination way down helps make the laser spots easier to find. In hardware, we synced vertical and horizontal counters up to the video signal and used a simple analog comparator with a little filtering to find a really bright spot in the otherwise dim image. Just scanning through the frame for a really bright red spot that is small should be possible to do in software at video speeds these days.
Good Luck, Bob
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
First, get a filter that filters everything but the laser wavelength. Edmund has these.
                    John Nagle
BobH wrote:

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
John Nagle wrote:

But since the OP is using two colors widely different colors (red and green), you'd need two cameras for each of the two filters, as a bandpass filter for both red and green would let in just about everything but blue.
If the laser light can be kept away from humans, IMO I think it's better to use infrared lasers, and vary the spot geometry in order to tell the two lasers apart. IR bandpass filters are cheaper, too.
Better yet (since shaping the beam cuts its power output), if the lasers are diode lasers as opposed to gas lasers, you could modulate them back and forth, and tell the MCU when you're toggling between R and L lasers. If you're grabbing frames, you can readily turn on one beam for 100 ms, take the snap shot, turn on the other beam, and take that snap shot. This would be better than using a green laser, which are much more expensive for equivalent output.
If humans are nearby, it's always a good idea to follow-spot the IR beam with another laser beam that is visible.
Bob's approach sounds like an LM1881 sync separator ($3, tops) connected to a simple ADC. Can be quite effective, but it's not as fun as playing with vision systems!
-- Gordon
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
wrote:

Bon,
Thank you for your reply. If it is not confidential, may I ask what was your HW applicacation for ? Why did you need to track laser spot? Is that HW solution commercially available?
Regards,
Albert
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Albert Goodwill wrote:

The application was for a firearms training simulator. A video projector was used to display a scenario from laser disk that the trainee interacted with. A small monochrome video camera was pointed at the screen. The output of the camera was fed into the board and software on the PC interpreted the laser spot appearances and locations.
Standard firearms were modified to insert an IR laser diode into the barrel. A piezo sensor detected the hammer fall or blank cartridge firing and triggered a pulse generator for the laser diode.
The software did not track a moving spot, so much as detect the presence and location of a pulse. Tracking a moving spot would not be a major addition.
The company sold that business off in the early 1990's and I don't know if it survived. The company I was working for did not.
Good Luck, Bob
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
What political motivation caused you to limit to C/C++ , Linux , Microsoft ? C is NOT for programming , its for obtuse . It prohibits you to program with your hands on the hardware . C will not alow you to test on the hardware . Use modern Forth.
I have BW $20 analog CCD cameras . I can create a Op System on ARM , STR711xxxx and teach it to do CDD camera . 1000 times faster than with C , Linux et al ..
Explain why you want to do it the hard way . Is there $$ in this obtuse method ?
_____________________________________
wrote:

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Albert Goodwill wrote:

I wrote a C++ program for tracking color blobs in a webcam stream. It uses Qt[1] for a GUI and OpenCV[2] for image acquisition. We were compiling on MSWinXP, but it should be an easy port to linux since all the libraries are cross-platform.
Subversion repository at http://androdna.com/pubsvn/compvision/trunk /
- Daniel
[1] http://www.trolltech.com/developer/downloads/qt/index [2] http://sourceforge.net/projects/opencvlibrary /
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Daniel,
THANK YOU very much for your reply and your open source code. I'm sure I will learn a lot from your codes. (Do you also have an Win exe to play immediately?)
Regards,
Albert
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Albert Goodwill wrote:

It works, but I'd rewrite some parts...

Sorry; I don't have one at the moment.
Compilation order: - MinGW-5.x.y.exe from http://sourceforge.net/project/showfiles.php?group_id $35 This will download and install the C++ compiler needed for Qt. - Qt After installing, select "build debug libraries" from the Start menu. - OpenCV installed to C:\OpenCV - CompVision use TortoiseSVN (http://tortoisesvn.tigris.org /) to download Then run `qmake` and `make` to build the project.
Let me know if you have trouble with any of this.
- Daniel
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
wrote:

You can try to gain laser colors and reduce the others. After that you can use FFT and reduce frequences that do not match your spots. The next step is to find a local maximum in your image.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Hi "vkle",
Thank you for your reply. "... gain laser colors and reduce the others." <-- How?
Is it possible in an average notebook pc to perform FFT over the entire frame at frame rate? Do you know any Linux+Windows open source code for this?
Regards,
Albert
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
wrote:

Look for CMVision library, maybe it can help.
About gaining colors...
About gaining colors. If you know laser spot color (or color interval) on your image you can gain it by adding constant to rgb value.
I think OpenCV have an FFT implementation.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

And could you provide some images from your camera with laser spots?
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Yes, you can find some images in http://www.geocities.com/albertgoodwill/lasertracking /
Albert
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
An FFT would be computational overkill!
Yes, an optical bandpass filter over the lens, matched to the frequency of the laser, will find your laser in bright lighting.
However, in your case the laser point will be so much brighter than the background that a simple adjustment of the gain and contrast of your camera should provide you with just a single "blob" that you can threshold against the background.
For more accurate X and Y, you can compute the center of mass of the blob.
Piece of cake...
Nelson MirageRobotics.com
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Yes, you can find some images in http://www.geocities.com/albertgoodwill/lasertracking /
Albert
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Yes, you can find some images in http://www.geocities.com/albertgoodwill/lasertracking /
Albert
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Here you can see some images:
http://vkle.1adw.com/f2.gif

and increased contrast, grayscale. So, after this manipulations you can find your spot like a local maximum of brightness.
If you do not want to use only a white wall as a background, you should make a more powerful filtration. Maybe morphologic filters, or maybe some clusterization algorithms and classification.
You can try to use spot image like a convolution matrix.
About images with laser stripes... just calculate mass center of a stripe.
P.S. Ask questions, and sorry for my english... =)
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.