Main MRPT website > C++ reference for MRPT 1.9.9
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-2017, 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 
14 namespace mrpt
15 {
16 namespace utils
17 {
18 /** This class encapsulates a MRPT Image and allows the sampling of individual
19  * pixels with sub-pixel accuracy and with a change of coordinates (eg, meters).
20  * Only work with graylevels (for convenience), so if a color image is passed
21  * it'll be passed first to grayscale.
22  *
23  * \sa CImage
24  * \ingroup mrpt_base_grp
25  */
27 {
28  protected:
30  double m_x0, m_x1, m_y0, m_y1;
31  /** width * pixel_size = (x1-x0) */
32  double m_pixel_size;
34 
35  public:
36  /** Constructor: Must pass an image (as a smart pointer) and the coordinates
37  * of the border
38  * \param img The image. A copy of the smart pointer is kept internally to
39  * this object.
40  * \param x0 Coordinate X of the left side (default: 0)
41  * \param x1 Coordinate X of the right side (or -1 to IMAGE_WIDTH-1)
42  * \param y0 Coordinate Y of the top side (default: 0)
43  * \param y1 Coordinate Y of the bottom side (or -1 to IMAGE_HEIGHT-1)
44  * \param method The interpolation method: It can be imNEAREST, imBILINEAR
45  * or imBICUBIC.
46  */
48  CImage::Ptr img, double x0 = 0, double x1 = -1, double y0 = 0,
49  double y1 = -1, TInterpolationMethod method = IMG_INTERP_LINEAR);
50 
51  /** Changes the coordinates of the image (see constructor for the meaning)
52  */
53  void changeCoordinates(double x0, double x1, double y0, double y1);
54 
55  /** Returns the interpolated pixel at the coordinates (x,y), in the range
56  * [0,255] (grayscale)
57  * If the point is out of the image, 0 is returned.
58  */
59  double getPixel(double x, double y) const;
60 
61 }; // End of class
62 
63 } // end of namespace utils
64 
65 } // end of namespace mrpt
66 
67 #endif
std::shared_ptr< CImage > Ptr
Definition: CImage.h:120
This class encapsulates a MRPT Image and allows the sampling of individual pixels with sub-pixel accu...
Definition: CMappedImage.h:27
TInterpolationMethod m_method
Definition: CMappedImage.h:33
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.
double m_pixel_size
width * pixel_size = (x1-x0)
Definition: CMappedImage.h:32
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)
GLenum GLint GLint y
Definition: glext.h:3538
GLint GLvoid * img
Definition: glext.h:3763
GLenum GLint x
Definition: glext.h:3538
TInterpolationMethod
Interpolation methods for images.
Definition: CImage.h:33
@ IMG_INTERP_LINEAR
Definition: CImage.h:35
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.



Page generated by Doxygen 1.9.1 for MRPT 1.9.9 Git: 63ea9d1f1 Thu Nov 23 00:06:53 2017 +0100 at mar 26 may 2026 12:19:29 CEST