Color Object Detector
Detects an object by a continuous color. Optionally draws on image.
Example for airframe file
Add to your firmware section: This example contains all possible configuration options, not all of them are mandatory!
<module name="cv_detect_color_object">
b'<define name="COLOR_OBJECT_DETECTOR_CAMERA1" value="front_camera|bottom_camera" />\n '
b'<define name="COLOR_OBJECT_DETECTOR_FPS1" value="0" />\n '
b'<define name="COLOR_OBJECT_DETECTOR_LUM_MIN1" value="0" />\n '
b'<define name="COLOR_OBJECT_DETECTOR_LUM_MAX1" value="0" />\n '
b'<define name="COLOR_OBJECT_DETECTOR_CB_MIN1" value="0" />\n '
b'<define name="COLOR_OBJECT_DETECTOR_CB_MAX1" value="0" />\n '
b'<define name="COLOR_OBJECT_DETECTOR_CR_MIN1" value="0" />\n '
b'<define name="COLOR_OBJECT_DETECTOR_CR_MAX1" value="0" />\n '
b'<define name="COLOR_OBJECT_DETECTOR_DRAW1" value="FALSE|TRUE" />\n\n '
b'<define name="COLOR_OBJECT_DETECTOR_CAMERA2" value="front_camera|bottom_camera" />\n '
b'<define name="COLOR_OBJECT_DETECTOR_FPS2" value="0" />\n '
b'<define name="COLOR_OBJECT_DETECTOR_LUM_MIN2" value="0" />\n '
b'<define name="COLOR_OBJECT_DETECTOR_LUM_MAX2" value="0" />\n '
b'<define name="COLOR_OBJECT_DETECTOR_CB_MIN2" value="0" />\n '
b'<define name="COLOR_OBJECT_DETECTOR_CB_MAX2" value="0" />\n '
b'<define name="COLOR_OBJECT_DETECTOR_CR_MIN2" value="0" />\n '
b'<define name="COLOR_OBJECT_DETECTOR_CR_MAX2" value="0" />\n '
b'<define name="COLOR_OBJECT_DETECTOR_DRAW2" value="FALSE|TRUE" />\n '
</module>
Module configuration options
Define Options
- name:
COLOR_OBJECT_DETECTOR_CAMERA1
value: front_camera|bottom_camera
Description: Video device to use
- name:
COLOR_OBJECT_DETECTOR_FPS1
value: 0
Description: Desired FPS (0: camera rate)
- name:
COLOR_OBJECT_DETECTOR_LUM_MIN1
value: 0
Description: Filter 1 min luminance
- name:
COLOR_OBJECT_DETECTOR_LUM_MAX1
value: 0
Description: Filter 1 max luminance
- name:
COLOR_OBJECT_DETECTOR_CB_MIN1
value: 0
Description: Filter 1 min blue chroma
- name:
COLOR_OBJECT_DETECTOR_CB_MAX1
value: 0
Description: Filter 1 max blue chroma
- name:
COLOR_OBJECT_DETECTOR_CR_MIN1
value: 0
Description: Filter 1 min red chroma
- name:
COLOR_OBJECT_DETECTOR_CR_MAX1
value: 0
Description: Filter 1 max red chroma
- name:
COLOR_OBJECT_DETECTOR_DRAW1
value: FALSE|TRUE
Description: Whether or not to draw on image
- name:
COLOR_OBJECT_DETECTOR_CAMERA2
value: front_camera|bottom_camera
Description: Video device to use
- name:
COLOR_OBJECT_DETECTOR_FPS2
value: 0
Description: Desired FPS (0: camera rate)
- name:
COLOR_OBJECT_DETECTOR_LUM_MIN2
value: 0
Description: Filter 1 min luminance
- name:
COLOR_OBJECT_DETECTOR_LUM_MAX2
value: 0
Description: Filter 2 max luminance
- name:
COLOR_OBJECT_DETECTOR_CB_MIN2
value: 0
Description: Filter 2 min blue chroma
- name:
COLOR_OBJECT_DETECTOR_CB_MAX2
value: 0
Description: Filter 2 max blue chroma
- name:
COLOR_OBJECT_DETECTOR_CR_MIN2
value: 0
Description: Filter 2 min red chroma
- name:
COLOR_OBJECT_DETECTOR_CR_MAX2
value: 0
Description: Filter 2 max red chroma
- name:
COLOR_OBJECT_DETECTOR_DRAW2
value: FALSE|TRUE
Description: Whether or not to draw on image
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 cv_detect_color_object.xml file:
<!DOCTYPE module SYSTEM "module.dtd">
<module name="cv_detect_color_object" dir="computer_vision">
<doc>
<description>Color Object Detector
Detects an object by a continuous color. Optionally draws on image.
</description>
<define name="COLOR_OBJECT_DETECTOR_CAMERA1" value="front_camera|bottom_camera" description="Video device to use"/>
<define name="COLOR_OBJECT_DETECTOR_FPS1" value="0" description="Desired FPS (0: camera rate)"/>
<define name="COLOR_OBJECT_DETECTOR_LUM_MIN1" value="0" description="Filter 1 min luminance"/>
<define name="COLOR_OBJECT_DETECTOR_LUM_MAX1" value="0" description="Filter 1 max luminance"/>
<define name="COLOR_OBJECT_DETECTOR_CB_MIN1" value="0" description="Filter 1 min blue chroma"/>
<define name="COLOR_OBJECT_DETECTOR_CB_MAX1" value="0" description="Filter 1 max blue chroma"/>
<define name="COLOR_OBJECT_DETECTOR_CR_MIN1" value="0" description="Filter 1 min red chroma"/>
<define name="COLOR_OBJECT_DETECTOR_CR_MAX1" value="0" description="Filter 1 max red chroma"/>
<define name="COLOR_OBJECT_DETECTOR_DRAW1" value="FALSE|TRUE" description="Whether or not to draw on image"/>
<define name="COLOR_OBJECT_DETECTOR_CAMERA2" value="front_camera|bottom_camera" description="Video device to use"/>
<define name="COLOR_OBJECT_DETECTOR_FPS2" value="0" description="Desired FPS (0: camera rate)"/>
<define name="COLOR_OBJECT_DETECTOR_LUM_MIN2" value="0" description="Filter 1 min luminance"/>
<define name="COLOR_OBJECT_DETECTOR_LUM_MAX2" value="0" description="Filter 2 max luminance"/>
<define name="COLOR_OBJECT_DETECTOR_CB_MIN2" value="0" description="Filter 2 min blue chroma"/>
<define name="COLOR_OBJECT_DETECTOR_CB_MAX2" value="0" description="Filter 2 max blue chroma"/>
<define name="COLOR_OBJECT_DETECTOR_CR_MIN2" value="0" description="Filter 2 min red chroma"/>
<define name="COLOR_OBJECT_DETECTOR_CR_MAX2" value="0" description="Filter 2 max red chroma"/>
<define name="COLOR_OBJECT_DETECTOR_DRAW2" value="FALSE|TRUE" description="Whether or not to draw on image"/>
</doc>
<settings>
<dl_settings>
<dl_settings name="ColorObjectDetector">
<dl_setting var="cod_lum_min1" min="0" step="1" max="255" shortname="y_min1"/>
<dl_setting var="cod_lum_max1" min="0" step="1" max="255" shortname="y_max1"/>
<dl_setting var="cod_cb_min1" min="0" step="1" max="255" shortname="u_min1"/>
<dl_setting var="cod_cb_max1" min="0" step="1" max="255" shortname="u_max1"/>
<dl_setting var="cod_cr_min1" min="0" step="1" max="255" shortname="v_min1"/>
<dl_setting var="cod_cr_max1" min="0" step="1" max="255" shortname="v_max1"/>
<dl_setting var="cod_draw1" min="0" step="1" max="1" values="False|True" shortname="draw 1" />
<dl_setting var="cod_lum_min2" min="0" step="1" max="255" shortname="y_min2"/>
<dl_setting var="cod_lum_max2" min="0" step="1" max="255" shortname="y_max2"/>
<dl_setting var="cod_cb_min2" min="0" step="1" max="255" shortname="u_min2"/>
<dl_setting var="cod_cb_max2" min="0" step="1" max="255" shortname="u_max2"/>
<dl_setting var="cod_cr_min2" min="0" step="1" max="255" shortname="v_min2"/>
<dl_setting var="cod_cr_max2" min="0" step="1" max="255" shortname="v_max2"/>
<dl_setting var="cod_draw2" min="0" step="1" max="1" values="False|True" shortname="draw 2" />
</dl_settings>
</dl_settings>
</settings>
<dep>
<depends>video_thread</depends>
</dep>
<header>
<file name="cv_detect_color_object.h"/>
</header>
<init fun="color_object_detector_init()"/>
<periodic fun="color_object_detector_periodic()" freq="50"/>
<makefile target="ap|nps">
<file name="cv_detect_color_object.c"/>
</makefile>
</module>