Main MRPT website > C++ reference for MRPT 1.4.0
CMappedImage.h
Go to the documentation of this file.
1/* +---------------------------------------------------------------------------+
2 | Mobile Robot Programming Toolkit (MRPT) |
3 | http://www.mrpt.org/ |
4 | |
5 | Copyright (c) 2005-2016, Individual contributors, see AUTHORS file |
6 | See: http://www.mrpt.org/Authors - All rights reserved. |
7 | Released under BSD License. See details in http://www.mrpt.org/License |
8 +---------------------------------------------------------------------------+ */
9#ifndef CMappedImage_H
10#define CMappedImage_H
11
12#include <mrpt/utils/CImage.h>
13
14namespace mrpt
15{
16 namespace utils
17 {
18 /** 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).
19 * Only work with graylevels (for convenience), so if a color image is passed it'll be passed first to grayscale.
20 *
21 * \sa CImage
22 * \ingroup mrpt_base_grp
23 */
25 {
26 protected:
28 double m_x0,m_x1, m_y0, m_y1;
29 double m_pixel_size; //!< width * pixel_size = (x1-x0)
31
32 public:
33 /** Constructor: Must pass an image (as a smart pointer) and the coordinates of the border
34 * \param img The image. A copy of the smart pointer is kept internally to this object.
35 * \param x0 Coordinate X of the left side (default: 0)
36 * \param x1 Coordinate X of the right side (or -1 to IMAGE_WIDTH-1)
37 * \param y0 Coordinate Y of the top side (default: 0)
38 * \param y1 Coordinate Y of the bottom side (or -1 to IMAGE_HEIGHT-1)
39 * \param method The interpolation method: It can be imNEAREST, imBILINEAR or imBICUBIC.
40 */
41 CMappedImage( CImagePtr img, double x0=0, double x1=-1, double y0=0, double y1=-1, TInterpolationMethod method = IMG_INTERP_LINEAR );
42
43 /** Changes the coordinates of the image (see constructor for the meaning) */
44 void changeCoordinates(double x0, double x1, double y0, double y1);
45
46 /** Returns the interpolated pixel at the coordinates (x,y), in the range [0,255] (grayscale)
47 * If the point is out of the image, 0 is returned.
48 */
49 double getPixel(double x,double y ) const;
50
51
52 }; // End of class
53
54
55 } // end of namespace utils
56
57} // end of namespace mrpt
58
59#endif
This class encapsulates a MRPT Image and allows the sampling of individual pixels with sub-pixel accu...
TInterpolationMethod m_method
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.
double m_pixel_size
width * pixel_size = (x1-x0)
double getPixel(double x, double y) const
Returns the interpolated pixel at the coordinates (x,y), in the range [0,255] (grayscale) If the poin...
void changeCoordinates(double x0, double x1, double y0, double y1)
Changes the coordinates of the image (see constructor for the meaning)
TInterpolationMethod
Interpolation methods for images.
Definition CImage.h:32
struct BASE_IMPEXP CImagePtr
Definition CImage.h:52
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.



Page generated by Doxygen 1.9.8 for MRPT 1.4.0 SVN: at Wed Dec 6 15:06:50 UTC 2023