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

Reply to
Albert Goodwill
Loading thread data ...

OpenCV's lukas-kanade tracker might be useful for tracking point features. See lkdemo.c in the samples directory after downloading opencv sources.

VKC

Reply to
vkc

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

Reply to
BobH

First, get a filter that filters everything but the laser wavelength. Edmund has these.

John Nagle

BobH wrote:

Reply to
John Nagle

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

Reply to
Albert Goodwill

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

Reply to
Gordon McComb

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

Reply to
BobH

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 ?

_____________________________________

Reply to
werty

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

formatting link

- Daniel

[1]
formatting link
formatting link
Reply to
D Herring

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.

Reply to
vkle

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

Reply to
Albert Goodwill

Hi "vkle",

Thank you for your reply. "... gain laser colors and reduce the others."

Reply to
Albert Goodwill

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

formatting link
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

formatting link
to download Then run `qmake` and `make` to build the project.

Let me know if you have trouble with any of this.

- Daniel

Reply to
D Herring

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.

Reply to
vkle

And could you provide some images from your camera with laser spots?

Reply to
vkle

Yes, you can find some images in

formatting link
Albert

Reply to
Albert Goodwill

Yes, you can find some images in

formatting link
Albert

Reply to
Albert Goodwill

Yes, you can find some images in

formatting link
Albert

Reply to
Albert Goodwill

Here you can see some images:

formatting link
From the top left corner, clockwise... source, decreased brightness 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... =)

Reply to
vkle

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

Reply to
Nelson

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.