Fawkes API
Fawkes Development Version
|
Bulb mirror lookup table. More...
#include <>>
Classes | |
struct | bulb_file_header_t |
bulb file header. More... | |
Public Member Functions | |
Bulb (const char *filename) | |
Constructor. More... | |
Bulb (const char *filename, const char *lut_id, bool destroy_on_delete=false) | |
Constructor. More... | |
Bulb (unsigned int width, unsigned int height) | |
Constructor. More... | |
Bulb (unsigned int width, unsigned int height, const char *lut_id, bool destroy_on_delete=false) | |
Constructor. More... | |
Bulb (const Bulb &bulb) | |
Copy constructor. More... | |
virtual | ~Bulb () |
Destructor. More... | |
virtual void | warp2unwarp (unsigned int warp_x, unsigned int warp_y, unsigned int *unwarp_x, unsigned int *unwarp_y) |
Transform warped to unwarped point. More... | |
virtual void | unwarp2warp (unsigned int unwarp_x, unsigned int unwarp_y, unsigned int *warp_x, unsigned int *warp_y) |
Transform unwarped to warped point. More... | |
virtual const char * | getName () |
Get name of model. More... | |
virtual bool | isValid () |
Check if a valid LUT has been loaded. More... | |
virtual void | setWorldPoint (unsigned int image_x, unsigned int image_y, float world_r, float world_phi) |
Set a world point mapping. More... | |
virtual fawkes::polar_coord_2d_t | getWorldPointRelative (unsigned int image_x, unsigned int image_y) const |
Get relative coordinate based on image coordinates. More... | |
virtual fawkes::cart_coord_2d_t | getWorldPointGlobal (unsigned int image_x, unsigned int image_y, float pose_x, float pose_y, float pose_ori) const |
Get global coordinate based on image coordinates. More... | |
virtual void | reset () |
Reset model. More... | |
virtual fawkes::upoint_t | getCenter () const |
Get the image pixel that is the center of the omni-camera. More... | |
virtual void | setCenter (unsigned int image_x, unsigned int image_y) |
Set center of omni-camera to given image pixel. More... | |
virtual void | setOrientation (float angle) |
Set orientation of the omni-camera device. More... | |
virtual float | getOrientation () const |
Get orientation of the omni-camera. More... | |
virtual bool | isValidPoint (unsigned int image_x, unsigned int image_y) const |
Check if the given point is valid. More... | |
bool | isNonZero (unsigned int image_x, unsigned int image_y) const |
Check if pixel maps to valid world point. More... | |
unsigned int | numNonZero () const |
Get number of non-zero entries. More... | |
float | getAngle (unsigned int image_x, unsigned int image_y) const |
Angle between direction to point and "to the right". More... | |
float | getDistanceInImage (unsigned int image_p1_x, unsigned int image_p1_y, unsigned int image_p2_x, unsigned int image_p2_y) |
Euklidean distance between to image points. More... | |
float | convertAngleI2W (float angle_in_image) const |
convertAngleI2W More... | |
void | load (const char *filename) |
Load LUT from file. More... | |
void | save (const char *filename) |
Save LUT from file. More... | |
const fawkes::polar_coord_2d_t * | get_lut () const |
Get the raw lookup table. More... | |
![]() | |
virtual | ~MirrorModel () |
Virtual empty destructor. More... | |
Static Public Member Functions | |
static std::string | composeFilename (const char *format) |
Compose a filename matching the given format. More... | |
Friends | |
class | BulbGenerator |
Bulb mirror lookup table.
This mirror model is based on a LUT that will map image pixels to radial coordinates in relative radial coordinates.
firevision::Bulb::Bulb | ( | const char * | filename | ) |
firevision::Bulb::Bulb | ( | const char * | filename, |
const char * | lut_id, | ||
bool | destroy_on_delete = false |
||
) |
Constructor.
Load bulb LUT from file and expose LUT via shared memory.
filename | filename of bulb file to load. |
lut_id | LUT ID |
destroy_on_delete | destroy LUT on delete |
firevision::Bulb::Bulb | ( | unsigned int | width, |
unsigned int | height | ||
) |
firevision::Bulb::Bulb | ( | unsigned int | width, |
unsigned int | height, | ||
const char * | lut_id, | ||
bool | destroy_on_delete = false |
||
) |
Constructor.
Create new empty bulb LUT and expose LUT via shared memory.
width | width of LUT |
height | height of LUT |
lut_id | LUT ID |
destroy_on_delete | destroy LUT on delete |
firevision::Bulb::Bulb | ( | const Bulb & | bulb | ) |
|
virtual |
|
static |
float firevision::Bulb::convertAngleI2W | ( | float | angle_in_image | ) | const |
const fawkes::polar_coord_2d_t * firevision::Bulb::get_lut | ( | ) | const |
float firevision::Bulb::getAngle | ( | unsigned int | image_x, |
unsigned int | image_y | ||
) | const |
Angle between direction to point and "to the right".
image_x | x coordinate in image |
image_y | y coordinate in image |
|
virtual |
Get the image pixel that is the center of the omni-camera.
Implements firevision::MirrorModel.
Definition at line 486 of file bulb.cpp.
References fawkes::upoint_t::x, and fawkes::upoint_t::y.
float firevision::Bulb::getDistanceInImage | ( | unsigned int | image_p1_x, |
unsigned int | image_p1_y, | ||
unsigned int | image_p2_x, | ||
unsigned int | image_p2_y | ||
) |
Euklidean distance between to image points.
image_p1_x | x coordinate in image of point 1 |
image_p1_y | y coordinate in image of point 1 |
image_p2_x | x coordinate in image of point 2 |
image_p2_y | y coordinate in image of point 2 |
|
virtual |
|
virtual |
Get orientation of the omni-camera.
Implements firevision::MirrorModel.
|
virtual |
Get global coordinate based on image coordinates.
image_x | x coordinate in image in pixels |
image_y | y coordinate in image in pixels |
pose_x | robot pose global x coordinate |
pose_y | robot pose global y coordinate |
pose_ori | robot pose global orientation |
Implements firevision::MirrorModel.
Definition at line 383 of file bulb.cpp.
References fawkes::polar_coord_2d_t::phi, fawkes::polar_coord_2d_t::r, fawkes::cart_coord_2d_struct::x, and fawkes::cart_coord_2d_struct::y.
|
virtual |
Get relative coordinate based on image coordinates.
image_x | x coordinate in image in pixels |
image_y | y coordinate in image in pixels |
Implements firevision::MirrorModel.
Definition at line 364 of file bulb.cpp.
References fawkes::polar_coord_2d_t::phi, and fawkes::polar_coord_2d_t::r.
Referenced by firevision::MirrorCalibTool::eval().
bool firevision::Bulb::isNonZero | ( | unsigned int | image_x, |
unsigned int | image_y | ||
) | const |
Check if pixel maps to valid world point.
image_x | x coordinate in image |
image_y | y coordinate in image |
|
virtual |
|
virtual |
Check if the given point is valid.
image_x | x coordinate of queried pixel in image |
image_y | y coordinate of queried pixel in image |
Implements firevision::MirrorModel.
void firevision::Bulb::load | ( | const char * | filename | ) |
Load LUT from file.
filename | name of LUT file |
Definition at line 251 of file bulb.cpp.
References firevision::Bulb::bulb_file_header_t::center_x, firevision::Bulb::bulb_file_header_t::center_y, firevision::Bulb::bulb_file_header_t::dist_max, firevision::Bulb::bulb_file_header_t::dist_min, firevision::Bulb::bulb_file_header_t::height, firevision::Bulb::bulb_file_header_t::orientation, and firevision::Bulb::bulb_file_header_t::width.
unsigned int firevision::Bulb::numNonZero | ( | ) | const |
|
virtual |
void firevision::Bulb::save | ( | const char * | filename | ) |
Save LUT from file.
filename | name of LUT file |
Definition at line 287 of file bulb.cpp.
References firevision::Bulb::bulb_file_header_t::center_x, firevision::Bulb::bulb_file_header_t::center_y, firevision::Bulb::bulb_file_header_t::dist_max, firevision::Bulb::bulb_file_header_t::dist_min, firevision::Bulb::bulb_file_header_t::height, firevision::Bulb::bulb_file_header_t::orientation, and firevision::Bulb::bulb_file_header_t::width.
Referenced by firevision::MirrorCalibTool::save().
|
virtual |
Set center of omni-camera to given image pixel.
image_x | x coordinate in image in pixels |
image_y | y coordinate in image in pixels |
Implements firevision::MirrorModel.
Definition at line 498 of file bulb.cpp.
Referenced by firevision::MirrorCalibTool::next_step().
|
virtual |
Set orientation of the omni-camera device.
angle | angle to the forward direction. |
Implements firevision::MirrorModel.
Definition at line 516 of file bulb.cpp.
Referenced by firevision::MirrorCalibTool::next_step().
|
virtual |
Set a world point mapping.
This modifies the mapping in the LUT. An exception is thrown if the coordinates are out of range or the distance is zero.
image_x | x coordinate of point in image in pixels |
image_y | y coordinate of point in image in pixels |
world_r | distance to real object from camera center in meters |
world_phi | angle to real object |
Definition at line 447 of file bulb.cpp.
Referenced by firevision::MirrorCalibTool::next_step().
|
virtual |
Transform unwarped to warped point.
Given a point in the unwarped image it returns the coordinates of the corresponding pixel in the warped image Useful for: You want to generate the unwarped image and ask the model for every point of the unwarped image which warped pixel to copy
unwarp_x | unwarped x coordinate |
unwarp_y | unwarped y coordinate |
warp_x | contains the warped x coordinate upon return |
warp_y | contains the warped y coordinate upon return |
Implements firevision::MirrorModel.
|
virtual |
Transform warped to unwarped point.
Given a point in the warped image it returns the coordinates of the corresponding pixel in the unwarped image Useful for: You found the ball center in the image and want to get the position this pixel would have in an unwarped image
warp_x | warped x coordinate |
warp_y | warped y coordinate |
unwarp_x | contains unwarped x coordinate upon return |
unwarp_y | contains unwarped y coordinate upon return |
Implements firevision::MirrorModel.