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