Bulb mirror lookup table. More...
#include <>>
Classes | |
struct | bulb_file_header_t |
bulb file header. More... | |
Public Member Functions | |
Bulb (const char *filename) | |
Constructor. | |
Bulb (const char *filename, const char *lut_id, bool destroy_on_delete=false) | |
Constructor. | |
Bulb (unsigned int width, unsigned int height) | |
Constructor. | |
Bulb (unsigned int width, unsigned int height, const char *lut_id, bool destroy_on_delete=false) | |
Constructor. | |
Bulb (const Bulb &bulb) | |
Copy constructor. | |
virtual | ~Bulb () |
Destructor. | |
virtual void | warp2unwarp (unsigned int warp_x, unsigned int warp_y, unsigned int *unwarp_x, unsigned int *unwarp_y) |
Transform warped to unwarped point. | |
virtual void | unwarp2warp (unsigned int unwarp_x, unsigned int unwarp_y, unsigned int *warp_x, unsigned int *warp_y) |
Transform unwarped to warped point. | |
virtual const char * | getName () |
Get name of model. | |
virtual bool | isValid () |
Check if a valid LUT has been loaded. | |
virtual void | setWorldPoint (unsigned int image_x, unsigned int image_y, float world_r, float world_phi) |
Set a world point mapping. | |
virtual fawkes::polar_coord_2d_t | getWorldPointRelative (unsigned int image_x, unsigned int image_y) const |
Get relative coordinate based on image coordinates. | |
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. | |
virtual void | reset () |
Reset model. | |
virtual fawkes::point_t | getCenter () const |
Get the image pixel that is the center of the omni-camera. | |
virtual void | setCenter (unsigned int image_x, unsigned int image_y) |
Set center of omni-camera to given image pixel. | |
virtual void | setOrientation (float angle) |
Set orientation of the omni-camera device. | |
virtual float | getOrientation () const |
Get orientation of the omni-camera. | |
virtual bool | isValidPoint (unsigned int image_x, unsigned int image_y) const |
Check if the given point is valid. | |
bool | isNonZero (unsigned int image_x, unsigned int image_y) const |
Check if pixel maps to valid world point. | |
unsigned int | numNonZero () const |
Get number of non-zero entries. | |
float | getAngle (unsigned int image_x, unsigned int image_y) const |
Angle between direction to point and "to the right". | |
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. | |
float | convertAngleI2W (float angle_in_image) const |
convertAngleI2W | |
void | load (const char *filename) |
Load LUT from file. | |
void | save (const char *filename) |
Save LUT from file. | |
Static Public Member Functions | |
static std::string | composeFilename (const char *format) |
Compose a filename matching the given format. | |
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.
Definition at line 38 of file bulb.h.
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 |
Definition at line 76 of file bulb.cpp.
References load().
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 | ) |
firevision::Bulb::~Bulb | ( | ) | [virtual] |
string firevision::Bulb::composeFilename | ( | const char * | format | ) | [static] |
float firevision::Bulb::convertAngleI2W | ( | float | angle_in_image | ) | 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 |
point_t firevision::Bulb::getCenter | ( | ) | const [virtual] |
Get the image pixel that is the center of the omni-camera.
Implements firevision::MirrorModel.
Definition at line 474 of file bulb.cpp.
References fawkes::point_t::x, and fawkes::point_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 |
Definition at line 591 of file bulb.cpp.
Referenced by setWorldPoint().
const char * firevision::Bulb::getName | ( | ) | [virtual] |
float firevision::Bulb::getOrientation | ( | ) | const [virtual] |
Get orientation of the omni-camera.
Implements firevision::MirrorModel.
cart_coord_2d_t firevision::Bulb::getWorldPointGlobal | ( | unsigned int | image_x, | |
unsigned int | image_y, | |||
float | pose_x, | |||
float | pose_y, | |||
float | pose_ori | |||
) | const [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 getWorldPointRelative(), fawkes::polar_coord_2d_t::phi, fawkes::polar_coord_2d_t::r, fawkes::cart_coord_2d_t::x, and fawkes::cart_coord_2d_t::y.
polar_coord_2d_t firevision::Bulb::getWorldPointRelative | ( | unsigned int | image_x, | |
unsigned int | image_y | |||
) | const [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 getWorldPointGlobal().
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 |
Definition at line 539 of file bulb.cpp.
Referenced by isValidPoint().
bool firevision::Bulb::isValid | ( | ) | [virtual] |
bool firevision::Bulb::isValidPoint | ( | unsigned int | image_x, | |
unsigned int | image_y | |||
) | const [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.
Definition at line 525 of file bulb.cpp.
References isNonZero().
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.
Referenced by Bulb().
unsigned int firevision::Bulb::numNonZero | ( | ) | const |
void firevision::Bulb::reset | ( | ) | [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.
void firevision::Bulb::setCenter | ( | unsigned int | image_x, | |
unsigned int | image_y | |||
) | [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.
void firevision::Bulb::setOrientation | ( | float | angle | ) | [virtual] |
Set orientation of the omni-camera device.
angle | angle to the forward direction. |
Implements firevision::MirrorModel.
void firevision::Bulb::setWorldPoint | ( | unsigned int | image_x, | |
unsigned int | image_y, | |||
float | world_r, | |||
float | world_phi | |||
) | [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 435 of file bulb.cpp.
References getDistanceInImage(), fawkes::polar_coord_2d_t::phi, and fawkes::polar_coord_2d_t::r.
void firevision::Bulb::unwarp2warp | ( | unsigned int | unwarp_x, | |
unsigned int | unwarp_y, | |||
unsigned int * | warp_x, | |||
unsigned int * | warp_y | |||
) | [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.
void firevision::Bulb::warp2unwarp | ( | unsigned int | warp_x, | |
unsigned int | warp_y, | |||
unsigned int * | unwarp_x, | |||
unsigned int * | unwarp_y | |||
) | [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.