MRPT
2.0.4
|
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.
Definition at line 23 of file CMappedImage.h.
#include <mrpt/img/CMappedImage.h>
Public Member Functions | |
CMappedImage (CImage::Ptr 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 | |
CImage::Ptr | 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 |
CMappedImage::CMappedImage | ( | CImage::Ptr | 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.
img | The image. A copy of the smart pointer is kept internally to this object. |
x0 | Coordinate X of the left side (default: 0) |
x1 | Coordinate X of the right side (or -1 to IMAGE_WIDTH-1) |
y0 | Coordinate Y of the top side (default: 0) |
y1 | Coordinate Y of the bottom side (or -1 to IMAGE_HEIGHT-1) |
method | The interpolation method: It can be imNEAREST, imBILINEAR or imBICUBIC. |
Definition at line 22 of file CMappedImage.cpp.
References changeCoordinates(), and m_img.
void CMappedImage::changeCoordinates | ( | double | x0, |
double | x1, | ||
double | y0, | ||
double | y1 | ||
) |
Changes the coordinates of the image (see constructor for the meaning)
Definition at line 46 of file CMappedImage.cpp.
References ASSERT_, m_img, m_pixel_size, m_x0, m_x1, m_y0, m_y1, MRPT_END, and MRPT_START.
Referenced by CMappedImage().
double 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.
Definition at line 73 of file CMappedImage.cpp.
References mrpt::img::IMG_INTERP_AREA, mrpt::img::IMG_INTERP_CUBIC, mrpt::img::IMG_INTERP_LINEAR, mrpt::img::IMG_INTERP_NN, m_img, m_method, m_pixel_size, m_x0, m_y0, mrpt::round(), and THROW_EXCEPTION.
|
protected |
Definition at line 26 of file CMappedImage.h.
Referenced by changeCoordinates(), CMappedImage(), and getPixel().
|
protected |
Definition at line 30 of file CMappedImage.h.
Referenced by getPixel().
|
protected |
width * pixel_size = (x1-x0)
Definition at line 29 of file CMappedImage.h.
Referenced by changeCoordinates(), and getPixel().
|
protected |
Definition at line 27 of file CMappedImage.h.
Referenced by changeCoordinates(), and getPixel().
|
protected |
Definition at line 27 of file CMappedImage.h.
Referenced by changeCoordinates().
|
protected |
Definition at line 27 of file CMappedImage.h.
Referenced by changeCoordinates(), and getPixel().
|
protected |
Definition at line 27 of file CMappedImage.h.
Referenced by changeCoordinates().
Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020 |