Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

2,171 views
Skip to first unread message

Albert Goodwill

unread,
Mar 10, 2007, 12:31:12 AM3/10/07
to
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

vkc

unread,
Mar 10, 2007, 4:28:38 AM3/10/07
to

> 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?

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

VKC

BobH

unread,
Mar 10, 2007, 4:45:44 PM3/10/07
to

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

John Nagle

unread,
Mar 10, 2007, 7:17:22 PM3/10/07
to
First, get a filter that filters everything but the laser wavelength.
Edmund has these.

John Nagle

Albert Goodwill

unread,
Mar 10, 2007, 9:35:59 PM3/10/07
to
On Mar 11, 8:45 am, BobH <WanderingMetalH...@DUMP.SPAM.yahoo.com>
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


Gordon McComb

unread,
Mar 10, 2007, 9:38:49 PM3/10/07
to
John Nagle wrote:
>
> First, get a filter that filters everything but the laser wavelength.
> Edmund has these.

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

BobH

unread,
Mar 10, 2007, 11:03:33 PM3/10/07
to
Albert Goodwill wrote:
> On Mar 11, 8:45 am, BobH <WanderingMetalH...@DUMP.SPAM.yahoo.com>
> wrote:
>> Albert Goodwill wrote:
>>> Hi,
>>> I want to locate/track a high intensity laser pointer spot on a live
>>> video.

> 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?

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

werty

unread,
Mar 11, 2007, 3:20:28 AM3/11/07
to

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 ?


_____________________________________


On Mar 9, 10:31 pm, "Albert Goodwill" <albertgoodw...@yahoo.com>
wrote:

D Herring

unread,
Mar 11, 2007, 9:15:44 AM3/11/07
to

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/

vkle

unread,
Mar 11, 2007, 12:51:42 PM3/11/07
to
On Mar 10, 8:31 am, "Albert Goodwill" <albertgoodw...@yahoo.com>
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.

Albert Goodwill

unread,
Mar 11, 2007, 6:43:03 PM3/11/07
to
On Mar 12, 12:15 am, D Herring <dherr...@at.tentpost.dot.com> wrote:
> Albert Goodwill wrote:
> > 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?
>
> 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 athttp://androdna.com/pubsvn/compvision/trunk/

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


Albert Goodwill

unread,
Mar 11, 2007, 6:46:35 PM3/11/07
to
> 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.

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


D Herring

unread,
Mar 12, 2007, 12:12:37 AM3/12/07
to
Albert Goodwill wrote:
> On Mar 12, 12:15 am, D Herring <dherr...@at.tentpost.dot.com> wrote:
>> Albert Goodwill wrote:
>>> I want to locate/track a high intensity laser pointer spot on a live
>>> video.
>>
>> 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/
>>
> THANK YOU very much for your reply and your open source code.
> I'm sure I will learn a lot from your codes.

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

> (Do you also have an Win exe to play immediately?)

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=2435
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

vkle

unread,
Mar 12, 2007, 8:22:30 AM3/12/07
to
On Mar 12, 1:46 am, "Albert Goodwill" <albertgoodw...@yahoo.com>
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.


vkle

unread,
Mar 12, 2007, 6:46:38 PM3/12/07
to

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

Albert Goodwill

unread,
Mar 12, 2007, 10:47:30 PM3/12/07
to

Yes, you can find some images in http://www.geocities.com/albertgoodwill/lasertracking/

Albert

Albert Goodwill

unread,
Mar 13, 2007, 1:23:52 AM3/13/07
to
> > 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.
>
> And could you provide some images from your camera with laser spots?

Yes, you can find some images in http://www.geocities.com/albertgoodwill/lasertracking/

Albert

vkle

unread,
Mar 13, 2007, 8:07:01 AM3/13/07
to
Here you can see some images: http://vkle.1adw.com/f2.gif
>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... =)


Albert Goodwill

unread,
Mar 12, 2007, 10:39:51 PM3/12/07
to
> > 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.
>
> And could you provide some images from your camera with laser spots?

Yes, you can find some images in http://www.geocities.com/albertgoodwill/lasertracking/

Albert

Nelson

unread,
Mar 16, 2007, 3:48:58 AM3/16/07
to
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


fangao...@gmail.com

unread,
Sep 18, 2015, 3:26:41 AM9/18/15
to
are you realize it?

Charlie Harris

unread,
Sep 18, 2015, 9:15:11 PM9/18/15
to
Hi Albert and Fangao

I would also like to know more of working model.

Could a flashing IR be read by a laser, to determine position on a model railway layout of a locomotive. Each IR with its own code.
Thanks

Charlie
0 new messages