Fawkes API
Fawkes Development Version
|
This class is used to draw a soccer field. More...
#include <>>
Public Member Functions | |
FieldDrawer (const FieldLines &lines) | |
Created a new field object. More... | |
virtual | ~FieldDrawer () |
Destructor. More... | |
void | set_head_yaw (float head_yaw) |
Sets the angular offset between body and head (along the body axis) More... | |
void | set_own_pos (fawkes::field_pos_t own_position) |
Own position setter. More... | |
void | set_own_pos_est (fawkes::field_pos_t own_position_estimate) |
Own position estimate setter. More... | |
void | set_line_points (const fld_line_points_t *points) |
Setter for detected line points. More... | |
void | set_line_points_est (const fld_line_points_t *points_est) |
Setter for detected line points. More... | |
void | set_color_background (YUV_t color) |
Sets the background color (outside the field) More... | |
void | set_color_field (YUV_t color) |
Sets the field color. More... | |
void | set_color_lines (YUV_t color) |
Sets the lines color. More... | |
void | set_color_line_points (YUV_t color) |
Sets the line points color. More... | |
void | set_color_line_points_est (YUV_t color) |
Sets the line points color. More... | |
void | set_color_own_pos (YUV_t color) |
Sets the own position color. More... | |
void | set_color_own_pos_est (YUV_t color) |
Sets the own position estimates color. More... | |
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]). More... | |
Protected Member Functions | |
void | clear_own_pos () |
Clears the own position. More... | |
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. More... | |
virtual void | draw_line_points (bool draw_landscape=true, float scale=0) const |
Draws the line points. More... | |
virtual void | draw_lines (YUV_t color, bool draw_landscape=true, float scale=0) const |
Draws the field lines to a SharedMemoryImageBuffer. More... | |
Protected Attributes | |
unsigned char * | _img_buffer |
The pointer to the target image buffer. More... | |
unsigned int | _img_width |
The width of the target image buffer. More... | |
unsigned int | _img_height |
The height of the target image buffer. More... | |
This class is used to draw a soccer field.
Definition at line 38 of file field_drawer.h.
firevision::FieldDrawer::FieldDrawer | ( | const FieldLines & | lines | ) |
Created a new field object.
lines | the field lines container |
Definition at line 60 of file field_drawer.cpp.
References firevision::YUV_t_struct::black(), clear_own_pos(), firevision::YUV_t_struct::cyan(), firevision::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(), firevision::YUV_t_struct::white(), and firevision::YUV_t_struct::yellow().
|
virtual |
Destructor.
Definition at line 82 of file field_drawer.cpp.
|
inlineprotected |
Clears the own position.
Used (e.g.) if the own position couldn't be calculated
Definition at line 124 of file field_drawer.cpp.
References _img_buffer, _img_height, _img_width, and fawkes::field_pos_t::ori.
Referenced by draw_field(), and FieldDrawer().
|
virtual |
Draws the field (including the own position [est]).
The position [est] and line points [est] gets reseted after drawing
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 259 of file field_drawer.cpp.
References _img_buffer, _img_height, _img_width, clear_own_pos(), firevision::ROI::contains(), firevision::Drawer::draw_circle(), firevision::Drawer::draw_line(), draw_line_points(), draw_lines(), firevision::FieldLines::get_field_length(), firevision::FieldLines::get_field_offsets(), firevision::FieldLines::get_field_width(), fawkes::field_pos_t::ori, firevision::Drawer::set_buffer(), firevision::Drawer::set_color(), firevision::YUV_t_struct::U, firevision::YUV_t_struct::V, fawkes::cart_coord_2d_struct::x, fawkes::field_pos_t::x, firevision::YUV_t_struct::Y, fawkes::cart_coord_2d_struct::y, and fawkes::field_pos_t::y.
|
protectedvirtual |
Draws the line points.
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 401 of file field_drawer.cpp.
References _img_buffer, _img_height, _img_width, firevision::Drawer::draw_cross(), firevision::FieldLines::get_field_length(), firevision::FieldLines::get_field_offsets(), firevision::FieldLines::get_field_width(), firevision::Drawer::set_buffer(), and firevision::Drawer::set_color().
Referenced by draw_field().
|
protectedvirtual |
Draws the field lines to a SharedMemoryImageBuffer.
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 445 of file field_drawer.cpp.
References _img_buffer, _img_height, _img_width, firevision::Drawer::draw_circle(), firevision::Drawer::draw_line(), firevision::FieldLines::get_circles(), firevision::FieldLines::get_field_length(), firevision::FieldLines::get_field_offsets(), firevision::FieldLines::get_field_width(), firevision::Drawer::set_buffer(), and firevision::Drawer::set_color().
Referenced by draw_field().
|
inlineprotected |
Calculates the conversion factor between field size and image size.
img_width | of the target image |
img_height | of the target image |
draw_landscape | true if the image should be drawn landscape |
Definition at line 169 of file field_drawer.cpp.
References firevision::FieldLines::get_field_length(), and firevision::FieldLines::get_field_width().
void firevision::FieldDrawer::set_color_background | ( | YUV_t | color | ) |
Sets the background color (outside the field)
color | to be used |
Definition at line 181 of file field_drawer.cpp.
Referenced by FieldDrawer().
void firevision::FieldDrawer::set_color_field | ( | YUV_t | color | ) |
Sets the field color.
color | to be used |
Definition at line 191 of file field_drawer.cpp.
Referenced by FieldDrawer().
void firevision::FieldDrawer::set_color_line_points | ( | YUV_t | color | ) |
Sets the line points color.
color | to be used |
Definition at line 211 of file field_drawer.cpp.
Referenced by FieldDrawer().
void firevision::FieldDrawer::set_color_line_points_est | ( | YUV_t | color | ) |
Sets the line points color.
color | to be used |
Definition at line 221 of file field_drawer.cpp.
Referenced by FieldDrawer().
void firevision::FieldDrawer::set_color_lines | ( | YUV_t | color | ) |
Sets the lines color.
color | to be used |
Definition at line 201 of file field_drawer.cpp.
Referenced by FieldDrawer().
void firevision::FieldDrawer::set_color_own_pos | ( | YUV_t | color | ) |
Sets the own position color.
color | to be used |
Definition at line 231 of file field_drawer.cpp.
Referenced by FieldDrawer().
void firevision::FieldDrawer::set_color_own_pos_est | ( | YUV_t | color | ) |
Sets the own position estimates color.
color | to be used |
Definition at line 241 of file field_drawer.cpp.
Referenced by FieldDrawer().
void firevision::FieldDrawer::set_head_yaw | ( | float | head_yaw | ) |
Sets the angular offset between body and head (along the body axis)
head_yaw | angular offset |
Definition at line 92 of file field_drawer.cpp.
void firevision::FieldDrawer::set_line_points | ( | const fld_line_points_t * | points | ) |
Setter for detected line points.
points | a list of line points (relative to the center of the field!) |
Definition at line 143 of file field_drawer.cpp.
void firevision::FieldDrawer::set_line_points_est | ( | const fld_line_points_t * | points_est | ) |
Setter for detected line points.
points_est | a list of line points (relative to the center of the field!) |
Definition at line 154 of file field_drawer.cpp.
void firevision::FieldDrawer::set_own_pos | ( | fawkes::field_pos_t | own_position | ) |
Own position setter.
Sets the (calculated) own position on the field
own_position | as calculated by the localization |
Definition at line 103 of file field_drawer.cpp.
void firevision::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, ...)
own_position_estimate | as estimated |
Definition at line 114 of file field_drawer.cpp.
|
protected |
The pointer to the target image buffer.
Definition at line 68 of file field_drawer.h.
Referenced by clear_own_pos(), draw_field(), draw_line_points(), and draw_lines().
|
protected |
The height of the target image buffer.
Definition at line 70 of file field_drawer.h.
Referenced by clear_own_pos(), draw_field(), draw_line_points(), and draw_lines().
|
protected |
The width of the target image buffer.
Definition at line 69 of file field_drawer.h.
Referenced by clear_own_pos(), draw_field(), draw_line_points(), and draw_lines().