FieldDrawer Class Reference
This class is used to draw a soccer field. More...
#include <field_drawer.h>
Public Member Functions | |
| FieldDrawer (const FieldLines &lines) | |
| Created a new field object. | |
| virtual | ~FieldDrawer () |
| Destructor. | |
| void | set_head_yaw (float head_yaw) |
| Sets the angular offset between body and head (along the body axis). | |
| void | set_own_pos (fawkes::field_pos_t own_position) |
| Own position setter. | |
| void | set_own_pos_est (fawkes::field_pos_t own_position_estimate) |
| Own position estimate setter. | |
| void | set_line_points (const fld_line_points_t *points) |
| Setter for detected line points. | |
| void | set_line_points_est (const fld_line_points_t *points_est) |
| Setter for detected line points. | |
| void | set_color_background (YUV_t color) |
| Sets the background color (outside the field). | |
| void | set_color_field (YUV_t color) |
| Sets the field color. | |
| void | set_color_lines (YUV_t color) |
| Sets the lines color. | |
| void | set_color_line_points (YUV_t color) |
| Sets the line points color. | |
| void | set_color_line_points_est (YUV_t color) |
| Sets the line points color. | |
| void | set_color_own_pos (YUV_t color) |
| Sets the own position color. | |
| void | set_color_own_pos_est (YUV_t color) |
| Sets the own position estimates color. | |
| virtual void | draw_field (unsigned char *yuv422_planar, unsigned int img_width, unsigned int img_height, bool draw_background=true, bool draw_landscape=true) |
| Draws the field (including the own position [est]). | |
Protected Member Functions | |
| void | clear_own_pos () |
| Clears the own position. | |
| float | get_scale (unsigned int img_width, unsigned int img_height, bool draw_landscape=true) const |
| Calculates the conversion factor between field size and image size. | |
| virtual void | draw_line_points (bool draw_landscape=true, float scale=0) const |
| Draws the line points. | |
| virtual void | draw_lines (YUV_t color, bool draw_landscape=true, float scale=0) const |
| Draws the field lines to a SharedMemoryImageBuffer. | |
Protected Attributes | |
| unsigned char * | _img_buffer |
| The pointer to the target image buffer. | |
| unsigned int | _img_width |
| The width of the target image buffer. | |
| unsigned int | _img_height |
| The height of the target image buffer. | |
Detailed Description
This class is used to draw a soccer field.
Definition at line 33 of file field_drawer.h.
Constructor & Destructor Documentation
| FieldDrawer::FieldDrawer | ( | const FieldLines & | lines | ) |
Created a new field object.
- Parameters:
-
lines the field lines container
Definition at line 55 of file field_drawer.cpp.
References YUV_t_struct::black(), clear_own_pos(), YUV_t_struct::cyan(), YUV_t_struct::green(), set_color_background(), set_color_field(), set_color_line_points(), set_color_line_points_est(), set_color_lines(), set_color_own_pos(), set_color_own_pos_est(), YUV_t_struct::white(), and YUV_t_struct::yellow().
| FieldDrawer::~FieldDrawer | ( | ) | [virtual] |
Member Function Documentation
| void FieldDrawer::clear_own_pos | ( | ) | [inline, protected] |
Clears the own position.
Used (e.g.) if the own position couldn't be calculated
Definition at line 119 of file field_drawer.cpp.
References _img_buffer, _img_height, _img_width, and fawkes::field_pos_t::ori.
Referenced by draw_field(), and FieldDrawer().
| void FieldDrawer::draw_field | ( | unsigned char * | yuv422_planar, | |
| unsigned int | img_width, | |||
| unsigned int | img_height, | |||
| bool | draw_background = true, |
|||
| bool | draw_landscape = true | |||
| ) | [virtual] |
Draws the field (including the own position [est]).
The position [est] and line points [est] gets reseted after drawing
- Parameters:
-
yuv422_planar the image buffer img_width the image width img_height the image height draw_background true if the background (field and border) should be drawn draw_landscape true if the field should be drawn landscape
Definition at line 254 of file field_drawer.cpp.
References _img_buffer, _img_height, _img_width, clear_own_pos(), ROI::contains(), Drawer::draw_circle(), Drawer::draw_line(), draw_line_points(), draw_lines(), FieldLines::get_field_length(), FieldLines::get_field_offsets(), FieldLines::get_field_width(), fawkes::field_pos_t::ori, Drawer::set_buffer(), Drawer::set_color(), YUV_t_struct::U, YUV_t_struct::V, fawkes::field_pos_t::x, fawkes::cart_coord_2d_t::x, fawkes::field_pos_t::y, fawkes::cart_coord_2d_t::y, and YUV_t_struct::Y.
| void FieldDrawer::draw_line_points | ( | bool | draw_landscape = true, |
|
| float | scale = 0 | |||
| ) | const [protected, virtual] |
Draws the line points.
- Parameters:
-
draw_landscape true if the field should be drawn landscape scale the pre calculated scale (conversion factor between image size and field size - if 0 the value gets calculated)
Definition at line 396 of file field_drawer.cpp.
References _img_buffer, _img_height, _img_width, Drawer::draw_cross(), FieldLines::get_field_length(), FieldLines::get_field_offsets(), FieldLines::get_field_width(), Drawer::set_buffer(), Drawer::set_color(), fawkes::cart_coord_2d_t::x, and fawkes::cart_coord_2d_t::y.
Referenced by draw_field().
| void FieldDrawer::draw_lines | ( | YUV_t | color, | |
| bool | draw_landscape = true, |
|||
| float | scale = 0 | |||
| ) | const [protected, virtual] |
Draws the field lines to a SharedMemoryImageBuffer.
- Parameters:
-
color of the lines draw_landscape if true (default) the field is supposed to be landscape scale the conversation factor between [m] and [px] (if 0 this value gets calculated)
Definition at line 440 of file field_drawer.cpp.
References _img_buffer, _img_height, _img_width, Drawer::draw_circle(), Drawer::draw_line(), FieldLines::get_circles(), FieldLines::get_field_length(), FieldLines::get_field_offsets(), FieldLines::get_field_width(), Drawer::set_buffer(), Drawer::set_color(), fawkes::cart_coord_2d_t::x, and fawkes::cart_coord_2d_t::y.
Referenced by draw_field().
| float FieldDrawer::get_scale | ( | unsigned int | img_width, | |
| unsigned int | img_height, | |||
| bool | draw_landscape = true | |||
| ) | const [inline, protected] |
Calculates the conversion factor between field size and image size.
- Parameters:
-
img_width of the target image img_height of the target image draw_landscape true if the image should be drawn landscape
- Returns:
- the conversion factor
Definition at line 164 of file field_drawer.cpp.
References FieldLines::get_field_length(), and FieldLines::get_field_width().
| void FieldDrawer::set_color_background | ( | YUV_t | color | ) |
Sets the background color (outside the field).
- Parameters:
-
color to be used
Definition at line 176 of file field_drawer.cpp.
Referenced by FieldDrawer().
| void FieldDrawer::set_color_field | ( | YUV_t | color | ) |
Sets the field color.
- Parameters:
-
color to be used
Definition at line 186 of file field_drawer.cpp.
Referenced by FieldDrawer().
| void FieldDrawer::set_color_line_points | ( | YUV_t | color | ) |
Sets the line points color.
- Parameters:
-
color to be used
Definition at line 206 of file field_drawer.cpp.
Referenced by FieldDrawer().
| void FieldDrawer::set_color_line_points_est | ( | YUV_t | color | ) |
Sets the line points color.
- Parameters:
-
color to be used
Definition at line 216 of file field_drawer.cpp.
Referenced by FieldDrawer().
| void FieldDrawer::set_color_lines | ( | YUV_t | color | ) |
Sets the lines color.
- Parameters:
-
color to be used
Definition at line 196 of file field_drawer.cpp.
Referenced by FieldDrawer().
| void FieldDrawer::set_color_own_pos | ( | YUV_t | color | ) |
Sets the own position color.
- Parameters:
-
color to be used
Definition at line 226 of file field_drawer.cpp.
Referenced by FieldDrawer().
| void FieldDrawer::set_color_own_pos_est | ( | YUV_t | color | ) |
Sets the own position estimates color.
- Parameters:
-
color to be used
Definition at line 236 of file field_drawer.cpp.
Referenced by FieldDrawer().
| void FieldDrawer::set_head_yaw | ( | float | head_yaw | ) |
Sets the angular offset between body and head (along the body axis).
- Parameters:
-
head_yaw angular offset
Definition at line 87 of file field_drawer.cpp.
| void FieldDrawer::set_line_points | ( | const fld_line_points_t * | points | ) |
Setter for detected line points.
- Parameters:
-
points a list of line points (relative to the center of the field!)
Definition at line 138 of file field_drawer.cpp.
| void FieldDrawer::set_line_points_est | ( | const fld_line_points_t * | points_est | ) |
Setter for detected line points.
- Parameters:
-
points_est a list of line points (relative to the center of the field!)
Definition at line 149 of file field_drawer.cpp.
| void FieldDrawer::set_own_pos | ( | fawkes::field_pos_t | own_position | ) |
Own position setter.
Sets the (calculated) own position on the field
- Parameters:
-
own_position as calculated by the localization
Definition at line 98 of file field_drawer.cpp.
| void FieldDrawer::set_own_pos_est | ( | fawkes::field_pos_t | own_position_estimate | ) |
Own position estimate setter.
Sets the position estimate (e.g. by triangulation, odometry, ...)
- Parameters:
-
own_position_estimate as estimated
Definition at line 109 of file field_drawer.cpp.
Member Data Documentation
float FieldDrawer::_img_buffer [protected] |
The pointer to the target image buffer.
Definition at line 63 of file field_drawer.h.
Referenced by clear_own_pos(), draw_field(), draw_line_points(), and draw_lines().
float FieldDrawer::_img_height [protected] |
The height of the target image buffer.
Definition at line 65 of file field_drawer.h.
Referenced by clear_own_pos(), draw_field(), draw_line_points(), and draw_lines().
float FieldDrawer::_img_width [protected] |
The width of the target image buffer.
Definition at line 64 of file field_drawer.h.
Referenced by clear_own_pos(), draw_field(), draw_line_points(), and draw_lines().
The documentation for this class was generated from the following files:
- src/firevision/fvutils/draw/field_drawer.h
- src/firevision/fvutils/draw/field_drawer.cpp

