WHEN BLOBS COLLIDE
A dramatic visual feature of the tracking software
is the ability to track objects that collide and
separate, for example two cars passing each
other in front of the camera. The video clip
on Flickr mentioned previously shows a vivid
example.
The logic to handle colliding objects is similar
to the logic that handles blockers. Every tracked
object has a predicted position for the current
frame. If two objects are predicted to collide,
and an observed blob is consistent in size and
location with the expected merged blob, then the
logic continues to update the tracked coordinates
to the predicted positions. This can continue for
several frames until the objects pass by each
other and are again tracked as separate blobs.
Before adding this feature, the tracking logic
would lose one of the objects and compute a
distorted position sequence for the other.
ARE WE THERE YET?
If you’re interested in the software you can pore
over the source code for more detail. The Open
CV library code provides methods for motion
detection and image manipulation, which are key
features of this application, but at least 90% of the
app is custom logic to organize and analyze the
detected motions. An idea that’s easy to express
in casual speech, such as whether the scene is
“mostly idle,” may take dozens of lines of code to
implement. The code to match observed blobs
to tracker instances is elaborate and involves
computing scores to determine the best match
and whether a blob represents a new object or
the continuation of a tracked object.
Some techniques in the code are very useful for
any project, such as using a worker thread and
command queue for console input, so that the
main thread remains free for image processing
and optionally displaying windows. You’ll also
find credits and links to earlier projects by Adrian
Rosebrock and John Beale that were a starting
point for the motion detection and tracking.
Thank you to these gentlemen, and to Paul
McWhorter whose YouTube series got me started
with OpenCV and video analysis software.
Collision insurance: The speed trap correctly tracks two
cars whose images collide and separate again.
83
make.co
M83_076-83_PiCamSpeedTrap_F1.indd 83M83_076-83_PiCamSpeedTrap_F1.indd 83 10/10/22 4:16 PM10/10/22 4:16 PM
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset