Maker Pro
Maker Pro

optical motion tracking

W

Wesley King

Hi,

I am using a webcam with an Infrared filter covering its lense
blocking all ambient light. I must track the movement of one pulsed
LED. I've tried looking for help on the web, however the articles I
find talk about motion detection with multiple cameras and sensors,
they are simply overcomplicated. Can anyone please direct me to more
suitable help,

Cheers,

Wesley.
 
J

John Fields

Hi,

I am using a webcam with an Infrared filter covering its lense
blocking all ambient light. I must track the movement of one pulsed
LED. I've tried looking for help on the web, however the articles I
find talk about motion detection with multiple cameras and sensors,
they are simply overcomplicated. Can anyone please direct me to more
suitable help,

---
Since you're the one who doesn't know how to do it, it seems incongruous
to me that you're making judgements about complexity.

Perhaps "This looks like it's going to be harder than I thought" might
be a better choice of words?

In any case, you haven't provided enough detail. For Starters, do you
want to track the LED in two dimensions or three?
 
G

GrahamH

Wesley King said:
Hi,

I am using a webcam with an Infrared filter covering its lense
blocking all ambient light. I must track the movement of one pulsed
LED. I've tried looking for help on the web, however the articles I
find talk about motion detection with multiple cameras and sensors,
they are simply overcomplicated. Can anyone please direct me to more
suitable help,

Cheers,

Wesley.

Here is an outline for you...

Capture images from the webcam
Logitech provide a free SDK for their cameras that is easy to use
You could look at video for windows and MCI, or DirectShow
You could start from Intel OpenCV (www.sourceforge.net/opencv) or MS
VisionSDK (http://research.microsoft.com/projects/VisSDK/) both provide
video capture frameworks

If you have control of the LED I would suggest that you take pairs of
images. One with the LED off and one with it on.
Subtract one image from the other and you should have a black scene with a
bright LED.
Given that you are IR filtering the camera the background may be much darker
than the LED anyway and you can skip the subtraction.

Given a dark image with one bright spot you can examine every pixel (or
every nth pixel for speed) looking for the brightest pixel in the image. If
you don't need much accuracy that might be enough. More likely you will want
to find the centroid or centre of gravity (COG) of the bright spot. If all
LED pixels are brighter than all other pixels in the image you can simply
average the x and y coordinates of all the pixels brighter than X (the
threshold, set to distinguish between background and LED).

If you have bright reflections and other clutter you may want to measure the
size of the spots you find and discard any bigger than A1 and smaller than
A2. You can measure area using a flood-fill algorithm centred on your
brightest pixel but the normal method is connected component labelling,
contour finding or blob labelling. OpenCV has functions to do this. Search
for those terms for more info. From a labelled blob or contour you can get
area and centroid.

If your scene is cluttered or the LED may be occluded by other objects in
the scene you may need to do motion track filtering. A filter commonly used
for this is a Kalman filter. This can predict where a tracked object will be
at a given time from now based on its motion so far. A simpler option is to
assume the new position is the bright spot closest to the previous position.

All that gets you the x,y position of the target in the image plane. If you
just want to move the camera to follow the light you can calculate the
off-centre error and feed it to your pan and tilt servos to centre the LED
in the image.

If you need to relate the LED's position to the real world that is a bit
more involved.

Graham
 
W

Wim Ton

Wesley King said:
Hi,

I am using a webcam with an Infrared filter covering its lense
blocking all ambient light. I must track the movement of one pulsed
LED. I've tried looking for help on the web, however the articles I
find talk about motion detection with multiple cameras and sensors,
they are simply overcomplicated. Can anyone please direct me to more
suitable help,
Maybe an optical mouse sensor with a different lens?

Wim.
 
J

Jamie

learn some programming..
sample the images and scan the image for the
dot!
its not to bad, i have used cheap USB cams to run into a
PC that controled robotic arm post to assembler very small
mica chip capacitors.
the arm can reach into a pile of mica cut sheets thus using a
small tube with controled vacuum to pick up a single sheet.
that is one camera, then we have another cam that watches the
arm as it places it sheet in the stacking frame, at this point it
can rotate , slide the sheet to make sure it's lined up before
inserting it into the assembly frame.
the conductive layers are also gided by the cam..
this is all done using 2 cheap cam's and a serious program written in
delphi..
the assembly time is very fast and reliable over human assembly
that use to be used making these hard devices.
the japanese are averaging 3 bad to 10 good Mica Chip's , we are
doing about 1 to 20, before it was like 5..10 ( 50%) yield
 
G

Guy Macon

Wesley King said:
I am using a webcam with an Infrared filter covering its lense
blocking all ambient light. I must track the movement of one pulsed
LED. I've tried looking for help on the web, however the articles I
find talk about motion detection with multiple cameras and sensors,
they are simply overcomplicated. Can anyone please direct me to more
suitable help,

Have you looked into using a PSD Photodiode instead of a webcam?
 
T

Tim Auton

I am using a webcam with an Infrared filter covering its lense
blocking all ambient light. I must track the movement of one pulsed
LED. I've tried looking for help on the web, however the articles I
find talk about motion detection with multiple cameras and sensors,
they are simply overcomplicated. Can anyone please direct me to more
suitable help,

Well, it's more a code question than an electronics question, so
asking in a machine vision group might get a better response.

You're also asking a very broad question (do you mean motion detection
or motion tracking - for one you can just see how many pixels have
changed, for the other you must identify your feature in successive
frames then determine if it's moved).

Basically you need to:

1. Get an image. How you do this will depend on your camera and
development environment. It's easy with Logitech's SDK and VC++.

2. Find the object in the image. This should be easy, it's the
brightest spot. Searching the array for the biggest number is the
crudest algorithm, or you can work out the centroid of the blob of
light. Astronomers do this all the time, so that might be a good place
to look if you need a centroiding algorithm. Record the coordinates.

3. Compare coordinates with previous coordinates and see if they've
changed enough to register as an event.

Goto 1.

The light flashing is a bit of extra complexity as you might miss it
in a particular frame, but there are any number of ways of dealing
with that depending how fast it flashes and how fast it moves.


Tim
 
P

Product developer

Wim Ton said:
Maybe an optical mouse sensor with a different lens?

Wim.

Why reinvent the wheel? This technology is off the shelf. Has been for
over a decade. Check EBAY
 
Top