Main MRPT website > C++ reference for MRPT 1.5.6
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 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:
27  CImagePtr m_img;
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
double m_pixel_size
width * pixel_size = (x1-x0)
Definition: CMappedImage.h:29
GLint GLvoid * img
Definition: glext.h:3645
TInterpolationMethod
Interpolation methods for images.
Definition: CImage.h:31
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
This class encapsulates a MRPT Image and allows the sampling of individual pixels with sub-pixel accu...
Definition: CMappedImage.h:24
GLenum GLint GLint y
Definition: glext.h:3516
TInterpolationMethod m_method
Definition: CMappedImage.h:30
GLenum GLint x
Definition: glext.h:3516



Page generated by Doxygen 1.8.14 for MRPT 1.5.6 Git: 4c65e8431 Tue Apr 24 08:18:17 2018 +0200 at lun oct 28 01:35:26 CET 2019