# Metavision Designer Optical Flow Sample¶

The Computer Vision API can be used to compute the optical flow of objects moving in front of the camera. The optical flow is computed in a sparse way in the sense that it is computed for clusters of events.

The sample in <install-prefix>/share/metavision/designer/cv/samples/metavision_sparse_optical_flow.py shows how to estimate and display a sparse optical flow.

## Expected Output¶

Metavision Optical Flow sample visualizes events and the output optical flow with arrows indicating direction and magnitude of motion:

## How to start¶

To start the sample based on the live stream from your camera, run:

Linux

python3 /usr/share/metavision/designer/cv/samples/metavision_sparse_optical_flow.py


Windows

python "C:\Program Files\Prophesee\share\metavision\designer\cv\sample\metavision_sparse_optical_flow.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):

Linux

python3 /usr/share/metavision/designer/cv/samples/metavision_sparse_optical_flow.py -i pedestrians.raw


Windows

python "C:\Program Files\Prophesee\share\metavision\designer\cv\samples\metavision_sparse_optical_flow.py" -i pedestrians.raw


To check for additional options:

Linux

python3 /usr/share/metavision/designer/cv/samples/metavision_sparse_optical_flow.py -h


Windows

python "C:\Program Files\Prophesee\share\metavision\designer\cv\samples\metavision_sparse_optical_flow.py" -h