PROJECTS Raspberry Pi Speed Camera
could be raw input data for your own analysis of
dog-walking and traffic patterns.
WIND TALES TAILS
So far it’s all been happy talk. Then comes a
windy day with moving clouds changing the light,
waving branches, moving tree shadows, and
leaves blowing around. These image changes
adversely impact the analysis and tracking logic.
While the program is running, a minimum blob
area can be adjusted with a console command to
ignore blobs that are smaller than the specified
value. For my setup, the minimum area defaults
to 150 pixels. A car’s area might be 3,000 pixels,
and the area of an SUV or truck might be 5,000 or
8,000. Setting the minimum area to 2,000 will still
track cars and trucks while eliminating of a lot of
wind noise.
An even larger noise correction exists with
the W command, which changes the background
calculation so that the current frame makes a
contribution to the background image used for
comparison before the comparison is made.
This is a big change from the usual behavior of
only making a contribution to the background
image when the scene is idle or mostly idle.
But the W command causes tracked vehicles
to have tails (Figures
J
and
K
)! The newly
revealed street at the rear of a moving vehicle
contrasts with the vehicle image that has been
part of the background for several frames.
The tail phenomenon explains why the speed
estimation is based only on the movement of
the leading edge, and why the logic does not pay
much attention to changes in the area of tracked
objects.
A recent improvement was made to greatly
reduce the recording of noise. Instead of saving
each frame as motion is detected, the frames are
queued to a buffer and file writing occurs after
a delay. During the delay, the tracker instances
decide if the motions have developed into
something interesting enough to be recorded.
J K
Back off, man: Speed is overestimated if moving objects are closer than the calibrated street.
Wind screen: A special command recalculates the background to cancel motion noise caused by the wind.
82 makezine.com
M83_076-83_PiCamSpeedTrap_F1.indd 82M83_076-83_PiCamSpeedTrap_F1.indd 82 10/10/22 4:16 PM10/10/22 4:16 PM