Fawkes API  Fawkes Development Version
firevision::MirrorCalibTool::CartesianImage Class Reference

Wraps an image so that access to (0, 0) is mapped to the middle of the image and so on. More...

Public Member Functions

 CartesianImage (const StepResult &res, PolarAngle phi, PixelPoint center, const unsigned char *mask=0)
 Constructor. More...
 
 CartesianImage (const StepResult &res, PolarAngle phi, const unsigned char *mask=0)
 Constructor. More...
 
 CartesianImage (const unsigned char *buf, int width, int height, PolarAngle phi, const PixelPoint &center)
 Constructor. More...
 
 CartesianImage (unsigned char *buf, int width, int height, PolarAngle phi, const PixelPoint &center)
 Constructor. More...
 
 CartesianImage (const unsigned char *buf, int width, int height, PolarAngle phi)
 Constructor. More...
 
 CartesianImage (unsigned char *buf, int width, int height, PolarAngle phi)
 Constructor. More...
 
unsigned char * buf ()
 Get Buffer. More...
 
const unsigned char * mask () const
 Mask. More...
 
const unsigned char * buf () const
 Buffer. More...
 
const PixelPointcenter () const
 Center of buffer. More...
 
int width () const
 Width of buffer. More...
 
int height () const
 Height of buffer. More...
 
PolarAngle phi () const
 Phi angle. More...
 
PixelPoint to_pixel (const CartesianPoint &p) const
 Converts a cartesian point to a pixel point. More...
 
CartesianPoint to_cartesian (const PixelPoint &p) const
 Converts a pixel point to a cartesian point. More...
 
bool contains (const PixelPoint &p) const
 Indicates whether the image contains a pixel point. More...
 
bool contains (const CartesianPoint &p) const
 Indicates whether the image contains a cartesian point. More...
 
unsigned char get (const CartesianPoint &p) const
 Get luminance at a given point. More...
 
int max_x () const
 Get Maximum cartesian X coordinate of the image. More...
 
int max_y () const
 Get Maximum cartesian Y coordinate of the image. More...
 
PolarRadius max_radius () const
 Maximum polar radius of the image. More...
 
void set_color (const PixelPoint &p, unsigned char luma, unsigned char chrominance)
 Sets the luminance Y and chrominance U at a given pixel point. More...
 
void set_color (const CartesianPoint &p, unsigned char luma, unsigned char chrominance)
 Sets the luminance Y and chrominance U at a given cartesian point. More...
 
float bright_fraction (const CartesianPoint &from, const CartesianPoint &to) const
 Get relative amount of bright pixels. More...
 
bool is_line (const CartesianPoint &p, int length) const
 Indicates whether at pixel point p there is a highlighted line. More...
 
void highlight_line (const CartesianPoint &p, int length)
 Highlightes a line at pixel point p. More...
 
void draw_line (const PixelPoint &p, const PixelPoint &q)
 Draws a line from p to q. More...
 
void draw_line (const CartesianPoint &p, const CartesianPoint &q)
 Draws a line from p to q. More...
 
void highlight_pixel (const PixelPoint &p)
 Highlights a pixel, i.e. More...
 
void highlight_point (const CartesianPoint &p)
 Highlights a point, i.e. More...
 

Detailed Description

Wraps an image so that access to (0, 0) is mapped to the middle of the image and so on.

The result is a cartesian coordinate system with X and Y axis.

Definition at line 337 of file mirror_calib.cpp.

Constructor & Destructor Documentation

◆ CartesianImage() [1/6]

firevision::MirrorCalibTool::CartesianImage::CartesianImage ( const StepResult res,
PolarAngle  phi,
PixelPoint  center,
const unsigned char *  mask = 0 
)
inline

Constructor.

Parameters
resThe step result that contains the base image.
phiThe angle by which the image is rotated counter-clockwise.
centerThe center of the image from the robot's point of view; i.e. the center of the cone mirror.
maskThe mask that indicates which pixels should be ignored.

Definition at line 354 of file mirror_calib.cpp.

◆ CartesianImage() [2/6]

firevision::MirrorCalibTool::CartesianImage::CartesianImage ( const StepResult res,
PolarAngle  phi,
const unsigned char *  mask = 0 
)
inline

Constructor.

Parameters
resThe step result that contains the base image.
phiThe angle by which the image is rotated counter-clockwise.
maskThe mask that indicates which pixels should be ignored.

Definition at line 371 of file mirror_calib.cpp.

◆ CartesianImage() [3/6]

firevision::MirrorCalibTool::CartesianImage::CartesianImage ( const unsigned char *  buf,
int  width,
int  height,
PolarAngle  phi,
const PixelPoint center 
)
inline

Constructor.

Parameters
bufThe base YUV buffer.
widthImage width.
heightImage height.
phiThe angle by which the image is rotated counter-clockwise.
centerThe center of the image from the robot's point of view; i.e. the center of the cone mirror.

Definition at line 388 of file mirror_calib.cpp.

◆ CartesianImage() [4/6]

firevision::MirrorCalibTool::CartesianImage::CartesianImage ( unsigned char *  buf,
int  width,
int  height,
PolarAngle  phi,
const PixelPoint center 
)
inline

Constructor.

Parameters
bufThe base YUV buffer.
widthImage width.
heightImage height.
phiThe angle by which the image is rotated counter-clockwise.
centerThe center of the image from the robot's point of view; i.e. the center of the cone mirror.

Definition at line 409 of file mirror_calib.cpp.

◆ CartesianImage() [5/6]

firevision::MirrorCalibTool::CartesianImage::CartesianImage ( const unsigned char *  buf,
int  width,
int  height,
PolarAngle  phi 
)
inline

Constructor.

Parameters
bufThe base YUV buffer.
widthImage width.
heightImage height.
phiThe angle by which the image is rotated counter-clockwise.

Definition at line 423 of file mirror_calib.cpp.

◆ CartesianImage() [6/6]

firevision::MirrorCalibTool::CartesianImage::CartesianImage ( unsigned char *  buf,
int  width,
int  height,
PolarAngle  phi 
)
inline

Constructor.

Parameters
bufThe base YUV buffer.
widthImage width.
heightImage height.
phiThe angle by which the image is rotated counter-clockwise.

Definition at line 438 of file mirror_calib.cpp.

Member Function Documentation

◆ bright_fraction()

float firevision::MirrorCalibTool::CartesianImage::bright_fraction ( const CartesianPoint from,
const CartesianPoint to 
) const
inline

Get relative amount of bright pixels.

Parameters
fromOne point of the rectangle.
toOpposite point of the rectangle.
Returns
relative amount of BRIGHT pixels in the rectangle denoted by the bottom-left (x1, y1) and the top-right (x2, y2).

Definition at line 627 of file mirror_calib.cpp.

References fawkes::contains(), firevision::MirrorCalibTool::Point::x, and firevision::MirrorCalibTool::Point::y.

◆ buf() [1/2]

unsigned char* firevision::MirrorCalibTool::CartesianImage::buf ( )
inline

Get Buffer.

Returns
buffer

Definition at line 452 of file mirror_calib.cpp.

◆ buf() [2/2]

const unsigned char* firevision::MirrorCalibTool::CartesianImage::buf ( ) const
inline

Buffer.

Returns
const buffer

Definition at line 468 of file mirror_calib.cpp.

◆ center()

const PixelPoint& firevision::MirrorCalibTool::CartesianImage::center ( ) const
inline

Center of buffer.

Returns
center point of buffer

Definition at line 476 of file mirror_calib.cpp.

◆ contains() [1/2]

bool firevision::MirrorCalibTool::CartesianImage::contains ( const CartesianPoint p) const
inline

Indicates whether the image contains a cartesian point.

Parameters
pThe point.
Returns
true if cartesian point is in image, false otherwise

Definition at line 542 of file mirror_calib.cpp.

References fawkes::contains().

◆ contains() [2/2]

bool firevision::MirrorCalibTool::CartesianImage::contains ( const PixelPoint p) const
inline

Indicates whether the image contains a pixel point.

Parameters
pThe point.
Returns
true if pixel point is in image, false otherwise

Definition at line 532 of file mirror_calib.cpp.

References firevision::MirrorCalibTool::Point::x, and firevision::MirrorCalibTool::Point::y.

Referenced by firevision::MirrorCalibTool::draw_crosshair(), firevision::MirrorCalibTool::draw_line(), and firevision::MirrorCalibTool::draw_mark_lines().

◆ draw_line() [1/2]

void firevision::MirrorCalibTool::CartesianImage::draw_line ( const CartesianPoint p,
const CartesianPoint q 
)
inline

Draws a line from p to q.

Parameters
pFirst point of the line.
qFirst point of the line.

Definition at line 693 of file mirror_calib.cpp.

References firevision::MirrorCalibTool::Point::atan(), fawkes::contains(), firevision::MirrorCalibTool::Point::length(), firevision::MirrorCalibTool::Point::x, and firevision::MirrorCalibTool::Point::y.

◆ draw_line() [2/2]

void firevision::MirrorCalibTool::CartesianImage::draw_line ( const PixelPoint p,
const PixelPoint q 
)
inline

Draws a line from p to q.

Parameters
pFirst point of the line.
qFirst point of the line.

Definition at line 684 of file mirror_calib.cpp.

◆ get()

unsigned char firevision::MirrorCalibTool::CartesianImage::get ( const CartesianPoint p) const
inline

Get luminance at a given point.

Parameters
pThe point.
Returns
luminance at given point

Definition at line 552 of file mirror_calib.cpp.

References fawkes::contains(), firevision::YUV_t_struct::U, firevision::YUV_t_struct::V, firevision::MirrorCalibTool::Point::x, firevision::YUV_t_struct::Y, and firevision::MirrorCalibTool::Point::y.

◆ height()

int firevision::MirrorCalibTool::CartesianImage::height ( ) const
inline

Height of buffer.

Returns
height of buffer

Definition at line 492 of file mirror_calib.cpp.

◆ highlight_line()

void firevision::MirrorCalibTool::CartesianImage::highlight_line ( const CartesianPoint p,
int  length 
)
inline

Highlightes a line at pixel point p.

Parameters
pThe center point of the line.
lengthThe length of the line.

Definition at line 672 of file mirror_calib.cpp.

References firevision::MirrorCalibTool::Point::atan(), fawkes::deg2rad(), firevision::MirrorCalibTool::Point::x, and firevision::MirrorCalibTool::Point::y.

◆ highlight_pixel()

void firevision::MirrorCalibTool::CartesianImage::highlight_pixel ( const PixelPoint p)
inline

Highlights a pixel, i.e.

sets the luminance and chrominance to MARK_LUMA and MARK_CHROMINANCE.

Parameters
pThe pixel.

Definition at line 709 of file mirror_calib.cpp.

References fawkes::contains(), firevision::MirrorCalibTool::Point::x, and firevision::MirrorCalibTool::Point::y.

Referenced by firevision::MirrorCalibTool::next_step().

◆ highlight_point()

void firevision::MirrorCalibTool::CartesianImage::highlight_point ( const CartesianPoint p)
inline

Highlights a point, i.e.

sets the luminance and chrominance to MARK_LUMA and MARK_CHROMINANCE.

Parameters
pThe point.

Definition at line 726 of file mirror_calib.cpp.

References fawkes::contains(), firevision::MirrorCalibTool::Point::x, and firevision::MirrorCalibTool::Point::y.

Referenced by firevision::MirrorCalibTool::next_step().

◆ is_line()

bool firevision::MirrorCalibTool::CartesianImage::is_line ( const CartesianPoint p,
int  length 
) const
inline

Indicates whether at pixel point p there is a highlighted line.

Parameters
pThe assumed center point of the line.
lengthThe length of the line
Returns
true if pixel belongs to line, false otherwise

Definition at line 655 of file mirror_calib.cpp.

References firevision::MirrorCalibTool::Point::atan(), fawkes::deg2rad(), firevision::MirrorCalibTool::Point::x, and firevision::MirrorCalibTool::Point::y.

◆ mask()

const unsigned char* firevision::MirrorCalibTool::CartesianImage::mask ( ) const
inline

Mask.

Returns
mask

Definition at line 460 of file mirror_calib.cpp.

◆ max_radius()

PolarRadius firevision::MirrorCalibTool::CartesianImage::max_radius ( ) const
inline

Maximum polar radius of the image.

Returns
Maximum polar radius of the image.

Definition at line 592 of file mirror_calib.cpp.

Referenced by firevision::MirrorCalibTool::draw_crosshair(), firevision::MirrorCalibTool::draw_line(), and firevision::MirrorCalibTool::draw_mark_lines().

◆ max_x()

int firevision::MirrorCalibTool::CartesianImage::max_x ( ) const
inline

Get Maximum cartesian X coordinate of the image.

Returns
Maximum cartesian X coordinate of the image.

Definition at line 576 of file mirror_calib.cpp.

◆ max_y()

int firevision::MirrorCalibTool::CartesianImage::max_y ( ) const
inline

Get Maximum cartesian Y coordinate of the image.

Returns
Maximum cartesian Y coordinate of the image.

Definition at line 584 of file mirror_calib.cpp.

◆ phi()

PolarAngle firevision::MirrorCalibTool::CartesianImage::phi ( ) const
inline

Phi angle.

Returns
Phi angle

Definition at line 500 of file mirror_calib.cpp.

◆ set_color() [1/2]

void firevision::MirrorCalibTool::CartesianImage::set_color ( const CartesianPoint p,
unsigned char  luma,
unsigned char  chrominance 
)
inline

Sets the luminance Y and chrominance U at a given cartesian point.

Parameters
pThe point whose luminance Y and chrominance U is changed.
lumaThe luminance Y.
chrominanceThe chrominance U.

Definition at line 616 of file mirror_calib.cpp.

◆ set_color() [2/2]

void firevision::MirrorCalibTool::CartesianImage::set_color ( const PixelPoint p,
unsigned char  luma,
unsigned char  chrominance 
)
inline

Sets the luminance Y and chrominance U at a given pixel point.

Parameters
pThe point whose luminance Y and chrominance U is changed.
lumaThe luminance Y.
chrominanceThe chrominance U.

Definition at line 602 of file mirror_calib.cpp.

References fawkes::contains(), firevision::MirrorCalibTool::Point::x, and firevision::MirrorCalibTool::Point::y.

Referenced by firevision::MirrorCalibTool::draw_crosshair(), firevision::MirrorCalibTool::draw_line(), and firevision::MirrorCalibTool::draw_mark_lines().

◆ to_cartesian()

CartesianPoint firevision::MirrorCalibTool::CartesianImage::to_cartesian ( const PixelPoint p) const
inline

Converts a pixel point to a cartesian point.

Parameters
pThe point.
Returns
converted point

Definition at line 521 of file mirror_calib.cpp.

References firevision::MirrorCalibTool::CartesianPoint::rotate(), firevision::MirrorCalibTool::Point::x, and firevision::MirrorCalibTool::Point::y.

◆ to_pixel()

PixelPoint firevision::MirrorCalibTool::CartesianImage::to_pixel ( const CartesianPoint p) const
inline

Converts a cartesian point to a pixel point.

Parameters
pThe point.
Returns
converted point

Definition at line 510 of file mirror_calib.cpp.

References firevision::MirrorCalibTool::CartesianPoint::rotate(), firevision::MirrorCalibTool::Point::x, and firevision::MirrorCalibTool::Point::y.

Referenced by firevision::MirrorCalibTool::next_step().

◆ width()

int firevision::MirrorCalibTool::CartesianImage::width ( ) const
inline

Width of buffer.

Returns
width of buffer

Definition at line 484 of file mirror_calib.cpp.


The documentation for this class was generated from the following file: