RaspiVid modified to provide image and motion vector data for processing in OpenCV.
The original RaspiVid.c is modified (see f564a2f) to pass image and
motion vector buffers to callbacks defined in cv.h
. File cv.cpp
implements
these callbacks and handles simple processing (display image and motion
vectors).
The motion vectors displayed by the application are colored according to their SAD (sum of absolute differences) value. SAD value of 0 corresponds to blue, SAD Threshold corresponds to red. Vectors with SAD above the threshold are not displayed:
First build the OpenCV library and make sure it is registered by
pkg-config
:
pkg-config --libs opencv
Then make the USERLAND_DIR
variable in Makefile
point to Raspberry Pi's
userland repository. Makefile
references some files required by
RaspiVidCv.c
.
Finally, build the application by make
and run it by make run
or:
raspicv -v -w 640 -h 480 -fps 30 -t 0 -o /dev/null -x /dev/null -r /dev/null -rf gray
Currently the cv.cpp
is limited to 640x480 grayscale image. This can be easily
modified (see function cv_init()
).