This example shows how opencv can be used on (for example) the Bebop drone.
Important to know is that sw/ext/opencv_bebop must be downloaded, and made. After this is done the folder sw/ext/opencv_bebop/install has a opencv.xml file. The LDFLAGS in this file should be the same as in this conf file.
Example for airframe file
Add to your firmware section: This example contains all possible configuration options, not all of them are mandatory!
1 <module name="cv_opencvdemo">
2 <define name="OPENCVDEMO_CAMERA" value="front_camera|bottom_camera" />
3 <define name="OPENCVDEMO_FPS" value="0" />
Module configuration options
Define Options
- name:
OPENCVDEMO_CAMERA
value: front_camera|bottom_camera
Description: Video device to use
- name:
OPENCVDEMO_FPS
value: 0
Description: The (maximum) frequency to run the calculations at. If zero, it will max out at the camera frame rate
Module functions
Init Functions
These initialization functions are called once on startup.
Files
Header Files
The following headers are automatically included in modules.h
Source Files
Raw cv_opencvdemo.xml file:
<!DOCTYPE module SYSTEM "module.dtd">
<module name="cv_opencvdemo" dir="computer_vision">
<doc>
<description>This example shows how opencv can be used on (for example) the Bebop drone.
Important to know is that sw/ext/opencv_bebop must be downloaded, and made.
After this is done the folder sw/ext/opencv_bebop/install has a opencv.xml file.
The LDFLAGS in this file should be the same as in this conf file.
</description>
<define name="OPENCVDEMO_CAMERA" value="front_camera|bottom_camera" description="Video device to use"/>
<define name="OPENCVDEMO_FPS" value="0" description="The (maximum) frequency to run the calculations at. If zero, it will max out at the camera frame rate"/>
</doc>
<header>
<file name="cv_opencvdemo.h"/>
</header>
<init fun="opencvdemo_init()"/>
<makefile target="ap">
<file name="cv_opencvdemo.c"/>
<file name="opencv_example.cpp"/>
<file name="opencv_image_functions.cpp"/>
<flag name="CXXFLAGS" value="I$(PAPARAZZI_SRC)/sw/ext/opencv_bebop/install/include"/>
<flag name="LDFLAGS" value="L$(PAPARAZZI_SRC)/sw/ext/opencv_bebop/install/lib" />
<flag name="LDFLAGS" value="lopencv_imgcodecs" />
<flag name="LDFLAGS" value="lopencv_imgproc" />
<flag name="LDFLAGS" value="lopencv_core" />
<flag name="LDFLAGS" value="L$(PAPARAZZI_HOME)/sw/ext/opencv_bebop/install/share/OpenCV/3rdparty/lib" />
<flag name="LDFLAGS" value="lzlib" />
<flag name="LDFLAGS" value="llibpng" />
<flag name="LDFLAGS" value="lstdc++" />
<flag name="LDFLAGS" value="ldl" />
<flag name="LDFLAGS" value="lm" />
<flag name="LDFLAGS" value="lpthread" />
<flag name="LDFLAGS" value="lrt" />
</makefile>
</module>