It interpolates one pixel based on a selected algorithm. Methods currently available are Nearest Neighbor, Bilinear, and Bicubic. More...
#include <Interpolator.h>
Public Types | |
| typedef InterpolationMethod | Method |
| Allowed interpolation methods. More... | |
Public Member Functions | |
| te::rst::Interpolator * | clone () const |
| Create a clone copy of this instance. More... | |
| void | getValue (const double &c, const double &r, std::complex< double > &v, const std::size_t &b) |
| Get the interpolated value at specific band. More... | |
| void | getValues (const double &c, const double &r, std::vector< std::complex< double > > &values) |
| Get the interpolated value for all bands. More... | |
| Interpolator (Raster const *r, int m) | |
| Constructor. More... | |
| Interpolator (Raster const *r, int m, const std::vector< std::complex< double > > &noDataValues) | |
| Constructor. More... | |
| virtual | ~Interpolator () |
| Destructor. More... | |
Protected Types | |
| typedef void(Interpolator::* | InterpolationFunction) (const double &c, const double &r, std::complex< double > &v, const std::size_t &b) |
| Type definition for the interpolation function. More... | |
Protected Member Functions | |
| void | bicubicGetValue (const double &c, const double &r, std::complex< double > &v, const std::size_t &b) |
| Bicubic interpolation method. More... | |
| void | bilinearGetValue (const double &c, const double &r, std::complex< double > &v, const std::size_t &b) |
| Bilinear interpolation method. More... | |
| bool | initialize (Raster const *const rasterPointer, int method, const std::vector< std::complex< double > > &noDataValues) |
| Initialize this instance.. More... | |
| void | nearestNeighborGetValue (const double &c, const double &r, std::complex< double > &v, const std::size_t &b) |
| Nearest neighbor interpolation method. More... | |
Protected Attributes | |
| double | m_bicBbufferImag [4][4] |
| double | m_bicBbufferReal [4][4] |
| unsigned | m_bicBufCol |
| unsigned | m_bicBufRow |
| double | m_bicColBound |
| Last column available for bicubic interpolation. More... | |
| unsigned | m_bicGridCol |
| unsigned | m_bicGridRow |
| double | m_bicHSum |
| double | m_bicHWeights [4] |
| double | m_bicKernel |
| double | m_bicOffsetX |
| double | m_bicOffsetY |
| double | m_bicReadImagValue |
| double | m_bicReadRealValue |
| double | m_bicRowAccumImag |
| double | m_bicRowAccumReal |
| double | m_bicRowBound |
| Last row available for bicubic interpolation. More... | |
| double | m_bicRowsValuesImag [4] |
| double | m_bicRowsValuesReal [4] |
| double | m_bicVSum |
| double | m_bicVWeights [4] |
| double | m_bilColDifMax |
| Maximum difference between columns (min/max). More... | |
| double | m_bilColDifMin |
| Minimum difference between columns (min/max). More... | |
| double | m_bilColMax |
| Maximum column for bilinear interpolation. More... | |
| double | m_bilColMin |
| Minimum column for bilinear interpolation. More... | |
| double | m_bilDistances [4] |
| Bilinear distances. More... | |
| double | m_bilLastCol |
| Last column available for bilinear interpolation. More... | |
| double | m_bilLastRow |
| Last row available for bilinear interpolation. More... | |
| double | m_bilRowDifMax |
| Maximum difference between rows (min/max). More... | |
| double | m_bilRowDifMin |
| Minimum difference between rows (min/max). More... | |
| double | m_bilRowMax |
| Maximum row for bilinear interpolation. More... | |
| double | m_bilRowMin |
| Minimum row for bilinear interpolation. More... | |
| std::vector< std::complex< double > > | m_bilValues |
| Bilinear values;. More... | |
| double | m_bilWeights [4] |
| Bilinear weights;. More... | |
| InterpolationFunction | m_function |
| The current interpolation function pointer. More... | |
| int | m_method |
| The interpolation method. More... | |
| unsigned int | m_nnCR |
| double | m_nnLastCol |
| Last column available for nearest Neighbor interpolation. More... | |
| double | m_nnLastRow |
| Last row available for nearest Neighbor interpolation. More... | |
| unsigned int | m_nnRR |
| std::vector< std::complex< double > > | m_noDataValues |
| Raster no-data values (for each band);. More... | |
| Raster const * | m_raster |
| My input raster. More... | |
It interpolates one pixel based on a selected algorithm. Methods currently available are Nearest Neighbor, Bilinear, and Bicubic.
Definition at line 55 of file Interpolator.h.
|
protected |
Type definition for the interpolation function.
| c | The column position (double). |
| r | The row position (double). |
| v | The output value. |
| b | The band to obtain the value. |
Definition at line 156 of file Interpolator.h.
Allowed interpolation methods.
Definition at line 62 of file Interpolator.h.
Constructor.
| r | The raster where to resample. |
| m | The method of interpolation to apply. |
Definition at line 49 of file Interpolator.cpp.
References initialize().
| te::rst::Interpolator::Interpolator | ( | Raster const * | r, |
| int | m, | ||
| const std::vector< std::complex< double > > & | noDataValues | ||
| ) |
Constructor.
| r | The raster where to resample. |
| m | The method of interpolation to apply. |
| noDataValues | A vector with no-data values (will overwride the input raster no-data values) or an empty vectory if the input raster no-data values must be used. |
Definition at line 57 of file Interpolator.cpp.
References initialize().
|
virtual |
|
protected |
Bicubic interpolation method.
| c | The column position (double). |
| r | The row position (double). |
| v | The output value. |
| b | The band to obtain the value. |
Definition at line 177 of file Interpolator.cpp.
References BICUBIC_KERNEL, te::rst::Raster::getIValue(), te::rst::Raster::getValue(), m_bicBbufferImag, m_bicBbufferReal, m_bicBufCol, m_bicBufRow, m_bicColBound, m_bicGridCol, m_bicGridRow, m_bicHSum, m_bicHWeights, m_bicKernel, m_bicOffsetX, m_bicOffsetY, m_bicReadImagValue, m_bicReadRealValue, m_bicRowAccumImag, m_bicRowAccumReal, m_bicRowBound, m_bicRowsValuesImag, m_bicRowsValuesReal, m_bicVSum, m_bicVWeights, m_noDataValues, m_raster, and nearestNeighborGetValue().
Referenced by initialize().
|
protected |
Bilinear interpolation method.
| c | The column position (double). |
| r | The row position (double). |
| v | The output value. |
| b | The band to obtain the value. |
Definition at line 106 of file Interpolator.cpp.
References te::rst::Raster::getValue(), m_bilColDifMax, m_bilColDifMin, m_bilColMax, m_bilColMin, m_bilDistances, m_bilLastCol, m_bilLastRow, m_bilRowDifMax, m_bilRowDifMin, m_bilRowMax, m_bilRowMin, m_bilValues, m_bilWeights, m_noDataValues, m_raster, and nearestNeighborGetValue().
Referenced by initialize().
| te::rst::Interpolator * te::rst::Interpolator::clone | ( | ) | const |
Create a clone copy of this instance.
Definition at line 85 of file Interpolator.cpp.
|
inline |
Get the interpolated value at specific band.
| c | The column position (double). |
| r | The row position (double). |
| v | The output value or the current input raster no-data value if the requested coordinates are outside the valid image bounds. |
| b | The band to obtain the value. |
Definition at line 93 of file Interpolator.h.
References b.
Referenced by BOOST_AUTO_TEST_CASE(), te::rp::ComposeBands(), te::mem::ExpansibleRaster::createMultiResolution(), te::rp::GeoMosaic::execute(), te::rp::Register::execute(), te::rp::TiePointsMosaic::execute(), getValues(), InterpolateIn(), te::rp::IHSFusion::loadIHSData(), te::rp::TiePointsLocatorStrategy::loadRasterData(), te::rp::PCAFusion::loadRessampledRaster(), and te::rp::RasterResample().
| void te::rst::Interpolator::getValues | ( | const double & | c, |
| const double & | r, | ||
| std::vector< std::complex< double > > & | values | ||
| ) |
Get the interpolated value for all bands.
| c | The column position (double). |
| r | The row position (double). |
| v | A vector of values, for all bands, or the current input raster no-data values if the requested coordinates are outside the valid image bounds.. |
Definition at line 71 of file Interpolator.cpp.
References b, te::rst::Raster::getNumberOfBands(), getValue(), and m_raster.
Referenced by te::rst::Raster::resample().
|
protected |
Initialize this instance..
| r | The raster where to resample. |
| method | The method of interpolation to apply. |
| noDataValues | A vector with no-data values (will overwride the input raster no-data values) or an empty vectory if the input raster no-data values must be used. |
Definition at line 256 of file Interpolator.cpp.
References te::rst::Bicubic, bicubicGetValue(), te::rst::Bilinear, bilinearGetValue(), te::rst::Raster::getAccessPolicy(), te::rst::Raster::getBand(), te::rst::Raster::getNumberOfBands(), te::rst::Raster::getNumberOfColumns(), te::rst::Raster::getNumberOfRows(), te::rst::Band::getProperty(), m_bicColBound, m_bicKernel, m_bicRowBound, m_bilLastCol, m_bilLastRow, m_bilValues, m_function, m_method, m_nnLastCol, m_nnLastRow, te::rst::BandProperty::m_noDataValue, m_noDataValues, m_raster, te::rst::NearestNeighbor, nearestNeighborGetValue(), te::common::RAccess, and rasterPointer.
Referenced by Interpolator().
|
protected |
Nearest neighbor interpolation method.
| c | The column position (double). |
| r | The row position (double). |
| v | The output value. |
| b | The band to obtain the value. |
Definition at line 91 of file Interpolator.cpp.
References b, te::rst::Raster::getValue(), m_nnCR, m_nnLastCol, m_nnLastRow, m_nnRR, m_noDataValues, m_raster, and te::rst::Round().
Referenced by bicubicGetValue(), bilinearGetValue(), and initialize().
|
protected |
Definition at line 207 of file Interpolator.h.
Referenced by bicubicGetValue().
|
protected |
Definition at line 206 of file Interpolator.h.
Referenced by bicubicGetValue().
|
protected |
Definition at line 203 of file Interpolator.h.
Referenced by bicubicGetValue().
|
protected |
Definition at line 202 of file Interpolator.h.
Referenced by bicubicGetValue().
|
protected |
Last column available for bicubic interpolation.
Definition at line 220 of file Interpolator.h.
Referenced by bicubicGetValue(), and initialize().
|
protected |
Definition at line 201 of file Interpolator.h.
Referenced by bicubicGetValue().
|
protected |
Definition at line 200 of file Interpolator.h.
Referenced by bicubicGetValue().
|
protected |
Definition at line 213 of file Interpolator.h.
Referenced by bicubicGetValue().
|
protected |
Definition at line 211 of file Interpolator.h.
Referenced by bicubicGetValue().
|
protected |
Definition at line 210 of file Interpolator.h.
Referenced by bicubicGetValue(), and initialize().
|
protected |
Definition at line 208 of file Interpolator.h.
Referenced by bicubicGetValue().
|
protected |
Definition at line 209 of file Interpolator.h.
Referenced by bicubicGetValue().
|
protected |
Definition at line 205 of file Interpolator.h.
Referenced by bicubicGetValue().
|
protected |
Definition at line 204 of file Interpolator.h.
Referenced by bicubicGetValue().
|
protected |
Definition at line 216 of file Interpolator.h.
Referenced by bicubicGetValue().
|
protected |
Definition at line 215 of file Interpolator.h.
Referenced by bicubicGetValue().
|
protected |
Last row available for bicubic interpolation.
Definition at line 219 of file Interpolator.h.
Referenced by bicubicGetValue(), and initialize().
|
protected |
Definition at line 218 of file Interpolator.h.
Referenced by bicubicGetValue().
|
protected |
Definition at line 217 of file Interpolator.h.
Referenced by bicubicGetValue().
|
protected |
Definition at line 214 of file Interpolator.h.
Referenced by bicubicGetValue().
|
protected |
Definition at line 212 of file Interpolator.h.
Referenced by bicubicGetValue().
|
protected |
Maximum difference between columns (min/max).
Definition at line 192 of file Interpolator.h.
Referenced by bilinearGetValue().
|
protected |
Minimum difference between columns (min/max).
Definition at line 191 of file Interpolator.h.
Referenced by bilinearGetValue().
|
protected |
Maximum column for bilinear interpolation.
Definition at line 188 of file Interpolator.h.
Referenced by bilinearGetValue().
|
protected |
Minimum column for bilinear interpolation.
Definition at line 187 of file Interpolator.h.
Referenced by bilinearGetValue().
|
protected |
Bilinear distances.
Definition at line 193 of file Interpolator.h.
Referenced by bilinearGetValue().
|
protected |
Last column available for bilinear interpolation.
Definition at line 197 of file Interpolator.h.
Referenced by bilinearGetValue(), and initialize().
|
protected |
Last row available for bilinear interpolation.
Definition at line 196 of file Interpolator.h.
Referenced by bilinearGetValue(), and initialize().
|
protected |
Maximum difference between rows (min/max).
Definition at line 190 of file Interpolator.h.
Referenced by bilinearGetValue().
|
protected |
Minimum difference between rows (min/max).
Definition at line 189 of file Interpolator.h.
Referenced by bilinearGetValue().
|
protected |
Maximum row for bilinear interpolation.
Definition at line 186 of file Interpolator.h.
Referenced by bilinearGetValue().
|
protected |
Minimum row for bilinear interpolation.
Definition at line 185 of file Interpolator.h.
Referenced by bilinearGetValue().
|
protected |
Bilinear values;.
Definition at line 195 of file Interpolator.h.
Referenced by bilinearGetValue(), and initialize().
|
protected |
|
protected |
The current interpolation function pointer.
Definition at line 173 of file Interpolator.h.
Referenced by initialize(), and ~Interpolator().
|
protected |
The interpolation method.
Definition at line 172 of file Interpolator.h.
Referenced by clone(), and initialize().
|
protected |
Definition at line 178 of file Interpolator.h.
Referenced by nearestNeighborGetValue().
|
protected |
Last column available for nearest Neighbor interpolation.
Definition at line 181 of file Interpolator.h.
Referenced by initialize(), and nearestNeighborGetValue().
|
protected |
Last row available for nearest Neighbor interpolation.
Definition at line 180 of file Interpolator.h.
Referenced by initialize(), and nearestNeighborGetValue().
|
protected |
Definition at line 179 of file Interpolator.h.
Referenced by nearestNeighborGetValue().
|
protected |
Raster no-data values (for each band);.
Definition at line 174 of file Interpolator.h.
Referenced by bicubicGetValue(), bilinearGetValue(), initialize(), and nearestNeighborGetValue().
|
protected |
My input raster.
Definition at line 171 of file Interpolator.h.
Referenced by bicubicGetValue(), bilinearGetValue(), clone(), getValues(), initialize(), and nearestNeighborGetValue().