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



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST