Main MRPT website > C++ reference for MRPT 1.4.0
List of all members | Public Member Functions | Protected Attributes
mrpt::utils::CMappedImage Class Reference

Detailed Description

This class encapsulates a MRPT Image and allows the sampling of individual pixels with sub-pixel accuracy and with a change of coordinates (eg, meters).

Only work with graylevels (for convenience), so if a color image is passed it'll be passed first to grayscale.

See also
CImage

Definition at line 24 of file CMappedImage.h.

#include <mrpt/utils/CMappedImage.h>

Public Member Functions

 CMappedImage (CImagePtr img, double x0=0, double x1=-1, double y0=0, double y1=-1, TInterpolationMethod method=IMG_INTERP_LINEAR)
 Constructor: Must pass an image (as a smart pointer) and the coordinates of the border. More...
 
void changeCoordinates (double x0, double x1, double y0, double y1)
 Changes the coordinates of the image (see constructor for the meaning) More...
 
double getPixel (double x, double y) const
 Returns the interpolated pixel at the coordinates (x,y), in the range [0,255] (grayscale) If the point is out of the image, 0 is returned. More...
 

Protected Attributes

CImagePtr m_img
 
double m_x0
 
double m_x1
 
double m_y0
 
double m_y1
 
double m_pixel_size
 width * pixel_size = (x1-x0) More...
 
TInterpolationMethod m_method
 

Constructor & Destructor Documentation

mrpt::utils::CMappedImage::CMappedImage ( CImagePtr  img,
double  x0 = 0,
double  x1 = -1,
double  y0 = 0,
double  y1 = -1,
TInterpolationMethod  method = IMG_INTERP_LINEAR 
)

Constructor: Must pass an image (as a smart pointer) and the coordinates of the border.

Parameters
imgThe image. A copy of the smart pointer is kept internally to this object.
x0Coordinate X of the left side (default: 0)
x1Coordinate X of the right side (or -1 to IMAGE_WIDTH-1)
y0Coordinate Y of the top side (default: 0)
y1Coordinate Y of the bottom side (or -1 to IMAGE_HEIGHT-1)
methodThe interpolation method: It can be imNEAREST, imBILINEAR or imBICUBIC.

Member Function Documentation

void mrpt::utils::CMappedImage::changeCoordinates ( double  x0,
double  x1,
double  y0,
double  y1 
)

Changes the coordinates of the image (see constructor for the meaning)

double mrpt::utils::CMappedImage::getPixel ( double  x,
double  y 
) const

Returns the interpolated pixel at the coordinates (x,y), in the range [0,255] (grayscale) If the point is out of the image, 0 is returned.

Member Data Documentation

CImagePtr mrpt::utils::CMappedImage::m_img
protected

Definition at line 27 of file CMappedImage.h.

TInterpolationMethod mrpt::utils::CMappedImage::m_method
protected

Definition at line 30 of file CMappedImage.h.

double mrpt::utils::CMappedImage::m_pixel_size
protected

width * pixel_size = (x1-x0)

Definition at line 29 of file CMappedImage.h.

double mrpt::utils::CMappedImage::m_x0
protected

Definition at line 28 of file CMappedImage.h.

double mrpt::utils::CMappedImage::m_x1
protected

Definition at line 28 of file CMappedImage.h.

double mrpt::utils::CMappedImage::m_y0
protected

Definition at line 28 of file CMappedImage.h.

double mrpt::utils::CMappedImage::m_y1
protected

Definition at line 28 of file CMappedImage.h.




Page generated by Doxygen 1.8.11 for MRPT 1.4.0 SVN:Unversioned directory at Tue Jun 28 11:46:25 UTC 2016