CornerHorizon Class Reference
Cut of arbitrary scanline models at an artificial horizon. More...
#include <models/scanlines/cornerhorizon.h>

Public Member Functions | |
| CornerHorizon (ScanlineModel *model, float field_length, float field_width, float field_border, unsigned int image_width, unsigned int image_height, float camera_height, float camera_ori, float horizontal_angle, float vertical_angle) | |
| Constructor. | |
| virtual | ~CornerHorizon () |
| Destructor. | |
| fawkes::point_t | operator* () |
| Get the current coordinate. | |
| fawkes::point_t * | operator-> () |
| Get pointer to current point. | |
| fawkes::point_t * | operator++ () |
| Postfix ++ operator. | |
| fawkes::point_t * | operator++ (int) |
| Prefix ++ operator. | |
| bool | finished () |
| Check if all desired points have been processed. | |
| void | reset () |
| Reset model. | |
| const char * | get_name () |
| Get name of scanline model. | |
| unsigned int | get_margin () |
| Get margin around points. | |
| void | set_robot_pose (float x, float y, float ori) |
| Set the robot's pose. | |
| void | set_pan_tilt (float pan, float tilt) |
| Set camera's pan/tilt values. | |
| unsigned int | getHorizon () |
| Get the horizon point. | |
Protected Member Functions | |
| void | calculate () |
| Calculate horizon point. | |
Detailed Description
Cut of arbitrary scanline models at an artificial horizon.The artificial horizon is calculated by the highest corner that is visible in the image. From that the Y coordinate in the image is used and everything above that point is ignored from the scanline grid.
This class was written in a one-night hacking sensation at RoboLudens 2006 in Eindhoven. For that time it is pretty readable code and we are using it since then. Cool!
Definition at line 35 of file cornerhorizon.h.
Constructor & Destructor Documentation
| CornerHorizon::CornerHorizon | ( | ScanlineModel * | model, | |
| float | field_length, | |||
| float | field_width, | |||
| float | field_border, | |||
| unsigned int | image_width, | |||
| unsigned int | image_height, | |||
| float | camera_height, | |||
| float | camera_ori, | |||
| float | horizontal_angle, | |||
| float | vertical_angle | |||
| ) |
Constructor.
- Parameters:
-
model Model to apply the artificial horizon on. This model is deleted on the destruction of the CornerHorizon instance so you can forget about it in the using application. field_length length of soccer field field_width width of soccer field field_border size of border around the field (i.e. distance between the outer white line and the physical field end) image_width image width in pixels image_height image height in pixels camera_height height of camera above ground camera_ori orientation of camera on the robot in degrees horizontal_angle horizontal viewing angle in degrees vertical_angle vertical viewing angle in degrees
Definition at line 65 of file cornerhorizon.cpp.
References fawkes::deg2rad(), fawkes::point_t::x, and fawkes::point_t::y.
| CornerHorizon::~CornerHorizon | ( | ) | [virtual] |
Destructor.
Not that this deletes the supplied model!
Definition at line 97 of file cornerhorizon.cpp.
Member Function Documentation
| void CornerHorizon::calculate | ( | ) | [protected] |
Calculate horizon point.
Definition at line 119 of file cornerhorizon.cpp.
References fawkes::normalize_mirror_rad().
Referenced by operator++().
| bool CornerHorizon::finished | ( | ) | [virtual] |
Check if all desired points have been processed.
- Returns:
- true if all pixels that the model defines have been iterated.
Implements ScanlineModel.
Definition at line 231 of file cornerhorizon.cpp.
References ScanlineModel::finished().
| unsigned int CornerHorizon::get_margin | ( | ) | [virtual] |
Get margin around points.
Models that do not use margins shall return zero. It shall be guaranteed that in this margin region around a point there is no other point that has been or will be returned in a full iteration.
- Returns:
- margin around a point.
Implements ScanlineModel.
Definition at line 254 of file cornerhorizon.cpp.
References ScanlineModel::get_margin().
| const char * CornerHorizon::get_name | ( | ) | [virtual] |
Get name of scanline model.
- Returns:
- name of scanline model.
Implements ScanlineModel.
Definition at line 247 of file cornerhorizon.cpp.
| unsigned int CornerHorizon::getHorizon | ( | ) |
Get the horizon point.
- Returns:
- y coordinate of the horizon point.
Definition at line 264 of file cornerhorizon.cpp.
| point_t CornerHorizon::operator* | ( | ) | [virtual] |
Get the current coordinate.
- Returns:
- current point in image that is shall be processed.
Implements ScanlineModel.
Definition at line 104 of file cornerhorizon.cpp.
| point_t * CornerHorizon::operator++ | ( | int | ) | [virtual] |
Prefix ++ operator.
Advances to the next point but returns the old point.
Implements ScanlineModel.
Definition at line 208 of file cornerhorizon.cpp.
References calculate(), ScanlineModel::finished(), fawkes::point_t::x, and fawkes::point_t::y.
| point_t * CornerHorizon::operator++ | ( | ) | [virtual] |
Postfix ++ operator.
Advances to the next point and returns the new point.
- Returns:
- pointer to new point
Implements ScanlineModel.
Definition at line 180 of file cornerhorizon.cpp.
References calculate(), ScanlineModel::finished(), fawkes::point_t::x, and fawkes::point_t::y.
| point_t * CornerHorizon::operator-> | ( | ) | [virtual] |
Get pointer to current point.
- Returns:
- pointer to current point
- See also:
- operator*()
Implements ScanlineModel.
Definition at line 111 of file cornerhorizon.cpp.
| void CornerHorizon::reset | ( | ) | [virtual] |
Reset model.
Resets the set of processed points.
Implements ScanlineModel.
Definition at line 238 of file cornerhorizon.cpp.
References ScanlineModel::reset(), fawkes::point_t::x, and fawkes::point_t::y.
| void CornerHorizon::set_pan_tilt | ( | float | pan, | |
| float | tilt | |||
| ) | [virtual] |
Set camera's pan/tilt values.
- Parameters:
-
pan camera's current pan tilt camera's current tilt
Implements ScanlineModel.
Definition at line 280 of file cornerhorizon.cpp.
| void CornerHorizon::set_robot_pose | ( | float | x, | |
| float | y, | |||
| float | ori | |||
| ) | [virtual] |
Set the robot's pose.
- Parameters:
-
x robot's x coordinate on field in meters y robot's y coordinate on field in meters ori robot's orientation. Looking towards the opponent goal is zero rad, with positive values pointing to the right, negative to the left.
Implements ScanlineModel.
Definition at line 271 of file cornerhorizon.cpp.
The documentation for this class was generated from the following files:
- src/firevision/models/scanlines/cornerhorizon.h
- src/firevision/models/scanlines/cornerhorizon.cpp

