Read video devices in a thread.
Manager module which creates a video processing thread for each video device to be used. Only for Linux devices. To be used in other modules for further processing (e.g. opticflow, QR code, streaming). Using 'cv_add_to_device' from cv.h will register a processing function and initialize the video device if necessary. Thread priority can be changed with VIDEO_THREAD_NICE_LEVEL.
Example for airframe file
Add to your firmware section: This example contains all possible configuration options, not all of them are mandatory!
<module name="video_thread">
b'<define name="VIDEO_THREAD_NICE_LEVEL" value="5" />\n '
</module>
Module configuration options
Define Options
- name:
VIDEO_THREAD_NICE_LEVEL
value: 5
Description: Nice level for each separate video thread
Module functions
Init Functions
These initialization functions are called once on startup.
Periodic Functions
These functions are called periodically at the specified frequency from the module periodic loop.
Files
Header Files
The following headers are automatically included in modules.h
Source Files
Raw video_thread.xml file:
<!DOCTYPE module SYSTEM "module.dtd">
<module name="video_thread" dir="computer_vision">
<doc>
<description>
Read video devices in a thread.
Manager module which creates a video processing thread for each video device to be used. Only for Linux devices.
To be used in other modules for further processing (e.g. opticflow, QR code, streaming). Using 'cv_add_to_device'
from cv.h will register a processing function and initialize the video device if necessary. Thread priority can
be changed with VIDEO_THREAD_NICE_LEVEL.
</description>
<define name="VIDEO_THREAD_NICE_LEVEL" value="5" description="Nice level for each separate video thread"/>
</doc>
<header>
<file name="video_thread.h"/>
</header>
<init fun="video_thread_init()"/>
<periodic fun="video_thread_periodic()" freq="1" start="video_thread_start()" stop="video_thread_stop()" autorun="TRUE"/>
<makefile target="ap">
<file name="video_thread.c"/>
<file name="cv.c"/>
<include name="modules/computer_vision"/>
<file name="image.c" dir="modules/computer_vision/lib/vision"/>
<file name="v4l2.c" dir="modules/computer_vision/lib/v4l"/>
<file name="virt2phys.c" dir="modules/computer_vision/lib/v4l"/>
<file name="jpeg.c" dir="modules/computer_vision/lib/encoding"/>
<define name="__USE_GNU"/>
<flag name="LDFLAGS" value="lrt"/>
<flag name="LDFLAGS" value="static-libgcc"/>
</makefile>
<makefile target="nps">
<file name="video_thread_nps.c"/>
<file name="cv.c"/>
<include name="modules/computer_vision"/>
<file name="image.c" dir="modules/computer_vision/lib/vision"/>
<file name="jpeg.c" dir="modules/computer_vision/lib/encoding"/>
<flag name="LDFLAGS" value="lpthread"/>
<define name="NPS_SIMULATE_VIDEO" value="1"/>
</makefile>
</module>