Metavision Designer Counting Sample¶
The Analytics API provides algorithms to count small fast moving objects.
The sample in <install-prefix>/share/metavision/designer/analytics/samples/metavision_counting.py shows how to count and display the objects passing in front of the camera.
Objects are counted per lines (by default, 4 horizontal lines are used), and we expect objects to move from top to bottom, like in free-fall. Each object is counted, when it crosses one of the horizontal lines. The number of lines and their positions can be specified using command-line arguments.
Metavision Counting sample visualizes events (from moving objects), lines on which objects are counted and the total object counter:
Setup & requirements¶
To accurately count objects, it is very important to fulfill some conditions:
the camera should be static and focused
there should be good contrast between the background and the objects (using a good backlight helps to get better results)
the least possible noise should be present
the events triggered by an object passing in front of the camera should be clustered as much as possible (i.e. no holes in the objects to avoid multiple detections)
Also, we recommend to find the right objective/optics and the right distance to objects, so that an object size seen by the camera is at least 5 pixels. The minimum real size of objects will depend on which objective/optics do you use.
Finally, depending on the speed of your objects (especially, for high speed), you might have to tune the sensor biases (settings) to get better data (make the sensor faster and/or less or more sensitive).
How to start¶
To start the sample based on the live stream from your camera, run:
python "C:\Program Files\Prophesee\share\metavision\designer\analytics\samples\metavision_counting.py"
To start the sample based on recorded data, provide the full path to a RAW file (here, we use the file from Metavision Dataset):
python3 /usr/share/metavision/designer/analytics/samples/metavision_counting.py -i 80_balls.raw
python "C:\Program Files\Prophesee\share\metavision\designer\analytics\samples\metavision_counting.py" -i 80_balls.raw
To check for additional options:
python3 /usr/share/metavision/designer/analytics/samples/metavision_counting.py -h
python "C:\Program Files\Prophesee\share\metavision\designer\analytics\samples\metavision_counting.py" -h