Class for efficient application of arbitrary 2D-2D transformations to whole images. More...
#include <ImageMapper.h>
Classes | |
struct | MapCoordinates |
Public Member Functions | |
CImageMapper (bool bInterpolate=true) | |
The only constructor of this class. More... | |
void | ComputeMap (int width, int height) |
This method initializes the instance for mapping of images of a specific size. More... | |
void | PerformMapping (const CByteImage *pInputImage, CByteImage *pOutputImage) |
This method performs the mapping. More... | |
virtual | ~CImageMapper () |
The destructor. More... | |
Private Member Functions | |
virtual void | ComputeOriginalCoordinates (const Vec2d &newCoordinates, Vec2d &originalCoordinates)=0 |
Private Attributes | |
int | height |
bool | m_bInterpolate |
bool | m_bMapComputed |
MapCoordinates * | m_pCoordinateMap |
int * | m_pOffsetMap |
int | width |
Class for efficient application of arbitrary 2D-2D transformations to whole images.
This class performs arbitrary 2D-2D transformations on instances of CByteImage. The 2D-2D transformation of interest must be specified by the inheriting class by implementing only (pure) virtual method: ComputeOriginalCoordinates(const Vec2d&, Vec2d&).
For initialization the method ComputeMap(int, int) must be called. Throughout initialization, an internal lookup table is built, including pre-computed coefficients for bilinear interpolation if the interpolation flag was set to true in the constructor CImageMapper(bool).
Bilinear interpolation has been optimized with integer arithmetics.
After initialization, the mapping is performed by calling the method PerformMapping(const CByteImage*, CByteImage*).
Images of type CByteImage::eGrayScale and CByteImage::eRGB24 are supported.
Definition at line 76 of file ImageMapper.h.
CImageMapper::CImageMapper | ( | bool | bInterpolate = true | ) |
The only constructor of this class.
Initialization is performed by calling the method ComputeMap(int, int).
[in] | bInterpolate | If set to true (default value) coefficients for bilinear interpolation are pre-computed throughout the initialization process and bilinear interpolation is performed when calling the method PerformMapping(const CByteImage*, CByteImage*). Bilinear interpolation has been optimized with integer arithmetics. If set to false, no interpolation takes place. |
Definition at line 64 of file ImageMapper.cpp.
|
virtual |
The destructor.
Does not need to be implemented by the inheriting class.
Definition at line 76 of file ImageMapper.cpp.
void CImageMapper::ComputeMap | ( | int | width, |
int | height | ||
) |
This method initializes the instance for mapping of images of a specific size.
This method must be called prior to use of PerformMapping(const CByteImage*, CByteIamge*). an internal lookup table is built, including pre-computed coefficients for bilinear interpolation if the interpolation flag was set to true in the constructor CImageMapper(bool).
[in] | width | The width of the images to be mapped in pixels. |
[in] | height | The height of the images to be mapped in pixels. |
Definition at line 90 of file ImageMapper.cpp.
void CImageMapper::PerformMapping | ( | const CByteImage * | pInputImage, |
CByteImage * | pOutputImage | ||
) |
This method performs the mapping.
Before application of this method, the instance must have been initialized by calling the method ComputeMap(int, int).
The width and height of pInputImage and pOutputImage must match.
pInputImage and pOutputImage must be either both of type CByteImage::eGrayScale or both of type CByteImage::eRGB24.
[in] | pInputImage | The input image. |
[out] | pOutputImage | The output image. |
Definition at line 171 of file ImageMapper.cpp.
|
private |
Definition at line 136 of file ImageMapper.h.
|
private |
Definition at line 143 of file ImageMapper.h.
|
private |
Definition at line 144 of file ImageMapper.h.
|
private |
Definition at line 140 of file ImageMapper.h.
|
private |
Definition at line 139 of file ImageMapper.h.
|
private |
Definition at line 136 of file ImageMapper.h.