| TerraLib 4.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes
TePDIMMIOMatching Class Reference
Image matching algorithms.

Modified Moravec Interest Operator based image area matching. More...

`#include <TePDIMMIOMatching.hpp>`

Inheritance diagram for TePDIMMIOMatching:

List of all members.

## Classes

class | CalcCCorrelationMtxParams
class | ExtractLocalMaximasParams
struct | GenerateCorrelationFeaturesParams
class | LoadImageParams
struct | MaximasListNodeT

## Public Types

enum | FeatMatchingMethod { NormCrossCorrMethod }

## Public Member Functions

| TePDIMMIOMatching ()
| ~TePDIMMIOMatching ()
bool | CheckParameters (const TePDIParameters &parameters) const
| Checks if the supplied parameters fits the requirements of each PDI algorithm implementation.

## Protected Types

typedef TePDIMatrix< unsigned char > | MaskMatrixT
typedef std::list < MaximasListNodeT > | MaximasListT
typedef std::pair< unsigned int, unsigned int > | MaximasMapNodeT
typedef std::multimap< double, MaximasMapNodeT > | MaximasMapT

## Protected Member Functions

bool | RunImplementation ()
| Runs the current algorithm implementation.
void | ResetState (const TePDIParameters &params)
| Reset the internal state to the initial state.
void | moravecRepeatability (const MaximasListT &inputList, const MaximasListT &constraintList, unsigned int constraintImageWidth, unsigned int constraintImageHeight, double moravecRepeatabilityMinTolerance, double moravecReSampleFactor, MaximasListT &outputList)
| Applies a Moravec repeatability constraint over an image maximas list.
bool | matchFeatures (FeatMatchingMethod matching_method, const TePDIMatrix< double > &img1featMtx, const MaximasListT &img1_maximas_list, const TePDIMatrix< double > &img2featMtx, const MaximasListT &img2_maximas_list, TeCoordPairVect &tiePointsVec, std::vector< double > &tiePointsWeights)
| Features matching and tie-points generation.

## Static Protected Member Functions

static void | loadImage (void *paramsPtr)
| A job function load raster data into a simple matrix.
static void | createImgMatrix (TeDataType dataType, TeSharedPtr< TePDIMtxDoubleAdptInt > &matrixPtr)
static void | extractLocalMaximas (void *paramsPtr)
| Extract local interest maxima points using a Modified Moravec Interest Operator aproach.
static bool | extractLocalMaximas (TePDIMtxDoubleAdptInt const *imgMatrixPtr, MaskMatrixT const *maskMatrixPtr, const unsigned int &xStart, const unsigned int &yStart, const unsigned int &width, const unsigned int &height, TePDIMatrix< double > &bufferMatrix, const unsigned int &moravecWindowSize, const unsigned int &maximasNumber, MaximasListT &outMaximasList, TePDIPIManager &progress)
| Extract local interest maxima points from an sub-image sub-region using a Modified Moravec Interest Operator aproach.
static void | generateCorrelationFeatures (void *paramsPtr)
| Generate correlation features.
static void | calcCCorrelationMtx (void *paramsPtr)
| cross-correlation matrix calcule.
static void | matrix2Tiff (const TePDIMtxDoubleAdptInt &input_matrix, const std::string &out_file_name, const MaximasListT &maxima_points=MaximasListT())
| Save the output matrix to a geotiff file.
static void | matrix2Tiff (const TePDIMtxDoubleAdptInt &input_matrix, const std::string &out_file_name, const TeCoordPairVect &tiepoints, bool usePt1)
| Save the output matrix to a geotiff file.
static void | doublesMatrix2Tiff (const TePDIMatrix< double > &input_matrix, const std::string &out_file_name, const MaximasListT &maxima_points=MaximasListT())
| Save the output matrix to a geotiff file.
static void | features2Tiff (unsigned int corr_window_width, const MaximasListT &img_maxima_points, TePDIMatrix< double > &img_features_matrix, const std::string &filenameaddon)
| Save the generated features to tif files.
static bool | bicubicResampleMatrix (const TePDIMtxDoubleAdptInt &inputMatrix, unsigned int outLines, unsigned int outCols, bool progressEnabled, TeMutex &globalMutex, double outMinValue, double outMaxValue, TePDIMtxDoubleAdptInt &outputMatrix)
| Input matrix bicubic resample.
static bool | generateMaximasRaster (const TePDIMtxDoubleAdptInt &inputMatrix, const MaximasListT &maximaPoints, TeRaster &outRaster)
| Generate the output maximas image ( 3 RGB bands where the maximas points are marked with value R255G0B0).

## Protected Attributes

const double | moravecDownSampleFactor_
const double | moravecUpSampleFactor_
const double | moravecRepeatabilityMinTolerance_
TeThreadJobsManager | jobsMan_
TeMutex | globalMutex_

## Detailed Description

Modified Moravec Interest Operator based image area matching.

Author:
  Emiliano F. Castejon <castejon@dpi.inpe.br>.

Note:
  The required parameters are:

Parameters:

  input_image1_ptr | (TePDITypes::TePDIRasterPtrType) - The input image 1.
  input_channel1 | ( unsigned int ) - Band to process from input_image1.
  input_image2_ptr | (TePDITypes::TePDIRasterPtrType) - The input image 2.
  input_channel2 | ( unsigned int ) - Band to process from input_image2.
  out_tie_points_ptr | ( TeSharedPtr< TeCoordPairVect > ) - The output tie-points where TeCoordPair.pt1 are input_image1 matricial indexes and TeCoordPair.pt2 are input_image2 matricial indexes.

Note:
  The Optional parameters are:

Parameters:

  matching_method | (TePDIMMIOMatching::FeatMatchingMethod) Features matching method (default: TePDIMMIOMatching::NormCrossCorrMethod).
  pixel_x_relation | (double) - The pixel resolution relation pixel_x_relation = img1_pixel_res_x / img2_pixel_res_x (default=1.0).
  pixel_y_relation | (double) - The pixel resolution relation pixel_y_relation = img1_pixel_res_y / img2_pixel_res_y (default=1.0).
  gt_params | ( TeGTParams ) - The geometric transformation parameters to be used (if not supplied, the dafult TeGTParams will be used - affine transformation, max direct mapping error = 2 pixels, RANSACRemotion outliers remotion ).
  out_gt_params_ptr | ( TeGTParams::pointer ) - The output parameters of internally generated geometric transformation (only valid when geometrical filtering is enabled).
  input_box1 | ( TeBox ) - Box (image matrix coords) to process from input_image1 ( the entire image will be used if no box was supplied ).
  input_box2 | ( TeBox ) - Box (image matrix coords) to process from input_image2 ( the entire image will be used if no box was supplied ).
  enable_multi_thread | (int) - If present (any value) a multi-threaded processing will be used. (default: multi-thread disabled).
  enable_threaded_raster_read | (int) - If present (any value) a multi-threaded input rasters data reading will be performed if enable_multi_thread is also enabled; Some TeDecoders do not support multi-thread so use it with caution (default: multi-threaded raster read disabled).
  max_tie_points | (unsigned int) - The maximum number of generated tie-points (default=1000).
  skip_geom_filter | (int) - If present (any value) will disable the geometric filtering ( default: geometric filtering enabled ).
  enable_upsampled_filter | (int) - If present (any value) will enable the upsampled image Moravec repeatability filter ( default: upsampled filtering disabled - only the downsampled image filter will be applied ).
  disable_reap_filter | (int) - If present (any value) will disable the image Moravec repeatability filters (upsample and downsample) ( default: filtering enabled - filter will be applied to avoid creation of tie-points over noisy areas).
  corr_window_width | (unsigned int) - The correlation window width used to correlate points between images (Must be an odd number, minimum 13, default: 21).
  moravec_window_width | (unsigned int) - The Moravec window width used to locate canditate tie-points (Must be an odd number, minimum 11, default: 11 ).
  out_tie_points_weights_ptr | ( TeSharedPtr< std::vector< double > > ) - The output tie- points weights vector (normalized between 0 and 1).
  mask_image1_ptr | (TePDITypes::TePDIRasterPtrType) - Mask image 1 pointer (tie-points falling inside mask image areas marked with zeroes will not be generated; this image must have the same number of lines/columns as input_image1).
  mask_image2_ptr | (TePDITypes::TePDIRasterPtrType) - Mask image 2 pointer (tie-points falling inside mask image areas marked with zeroes will not be generated; this image must have the same number of lines/columns as input_image1).
  disable_subimage_search | (int) - If present (any value) the sub-image search will not enabled (the sub-image search improves the tie-point distribution homogeneity - default:sub-image search enabled).
  out_maximas_image1_ptr | (TePDITypes::TePDIRasterPtrType) - This parameters is for visualization and test purposes and if this parameter is present and the pointer is valid (pointing to a valid raster instance) the output maximas image (frim input image 1) will be generated an copied to the pointed raster (this raster will be initiated to 3 RGB bands where the maximas points are marked with value R255G0B0).
  out_maximas_image2_ptr | - The same as the out_maximas_image1_ptr parameter but for the second input image.

Examples:

  TePDIMMIOMatching_test.cpp.

## Member Typedef Documentation

typedef TePDIMatrix< unsigned char > TePDIMMIOMatching::MaskMatrixT`[protected]`

Mask matrix type.

typedef std::list< MaximasListNodeT > TePDIMMIOMatching::MaximasListT`[protected]`

Maximas list type

typedef std::pair< unsigned int, unsigned int > TePDIMMIOMatching::MaximasMapNodeT`[protected]`

Ordered maximas map node type

Parameters:

  unsigned | int (first) Column - X.
  unsigned | int (second) Line - Y.

typedef std::multimap< double, MaximasMapNodeT > TePDIMMIOMatching::MaximasMapT`[protected]`

Ordered maximas map type.

## Member Enumeration Documentation

enum TePDIMMIOMatching::FeatMatchingMethod

Features matching methods.

Enumerator:

  NormCrossCorrMethod | Features normalized cross-correlation method

## Constructor & Destructor Documentation

TePDIMMIOMatching::TePDIMMIOMatching | ( |  | ) |

TePDIMMIOMatching::~TePDIMMIOMatching | ( |  | ) |

## Member Function Documentation

bool TePDIMMIOMatching::bicubicResampleMatrix | ( | const TePDIMtxDoubleAdptInt & | inputMatrix,
|  | unsigned int | outLines,
|  | unsigned int | outCols,
|  | bool | progressEnabled,
|  | TeMutex & | globalMutex,
|  | double | outMinValue,
|  | double | outMaxValue,
|  | TePDIMtxDoubleAdptInt & | outputMatrix
| ) |  | `[static, protected]`

Input matrix bicubic resample.

Parameters:

  inputMatrix | Input matrix.
  outLines | Output number of lines.
  outCols | Output number of columns.
  progressEnabled | Progress enabled flag.
  globalMutex | Global mutex.
  outMinValue | The allowed output min value.
  outMaxValue | The allowed output max value.
  outputMatrix | Output matrix.

Returns:
  true if OK, false on errors.

void TePDIMMIOMatching::calcCCorrelationMtx | ( | void * | paramsPtr | ) | `[static, protected]`

cross-correlation matrix calcule.

Parameters:

  paramsPtr | The parameters needed for the thread execution (a pointer to a CalcCCorrelationMtxParams struct).

bool TePDIMMIOMatching::CheckParameters | ( | const TePDIParameters & | parameters | ) | const`[virtual]`

Checks if the supplied parameters fits the requirements of each PDI algorithm implementation.

Note:
  Error log messages must be generated. No exceptions generated.

Parameters:

  parameters | The parameters to be checked.

Returns:
  true if the parameters are OK. false if not.

Implements TePDIAlgorithm.

void TePDIMMIOMatching::createImgMatrix | ( | TeDataType | dataType,
|  | TeSharedPtr< TePDIMtxDoubleAdptInt > & | matrixPtr
| ) |  | `[static, protected]`

Instantiate an image matrix capable of store pixel data of the supplied type.

Parameters:

  dataType | Pixel type.
  matrixPtr | A pointer for the new created matrix.

void TePDIMMIOMatching::doublesMatrix2Tiff | ( | const TePDIMatrix< double > & | input_matrix,
|  | const std::string & | out_file_name,
|  | const MaximasListT & | maxima_points = `MaximasListT()`
| ) |  | `[static, protected]`

Save the output matrix to a geotiff file.

Parameters:

  input_matrix | Input matrix.
  out_file_name | Output file name.
  maxima_points | The maxima points to be filled with 255

bool TePDIMMIOMatching::extractLocalMaximas | ( | TePDIMtxDoubleAdptInt const * | imgMatrixPtr,
|  | MaskMatrixT const * | maskMatrixPtr,
|  | const unsigned int & | xStart,
|  | const unsigned int & | yStart,
|  | const unsigned int & | width,
|  | const unsigned int & | height,
|  | TePDIMatrix< double > & | bufferMatrix,
|  | const unsigned int & | moravecWindowSize,
|  | const unsigned int & | maximasNumber,
|  | MaximasListT & | outMaximasList,
|  | TePDIPIManager & | progress
| ) |  | `[static, protected]`

Extract local interest maxima points from an sub-image sub-region using a Modified Moravec Interest Operator aproach.

Parameters:

  imgMatrixPtr | Input image matrix pointer.
  maskMatrixPtr | Input mask matrix pointer (or null if mask is not used).
  xStart | Image sub-region initial X coordinate.
  yStart | Image sub-region initial y coordinate.
  width | Image sub-region width.
  height | Image sub-region height.
  bufferMatrix | Pre-initiated buffer with at least width x height.
  moravecWindowSize | Moravec window size
  maximasNumber | The number of maximas to append to outMaximasMap.
  outMaximasList | The found maximas will be appended to this container.
  progres | Progress interface manager reference.
  return | true if OK, false on errors.

void TePDIMMIOMatching::extractLocalMaximas | ( | void * | paramsPtr | ) | `[static, protected]`

Extract local interest maxima points using a Modified Moravec Interest Operator aproach.

Parameters:

  paramsPtr | The parameters needed for the thread execution (a pointer to a ExtractLocalMaximasParams struct).

void TePDIMMIOMatching::features2Tiff | ( | unsigned int | corr_window_width,
|  | const MaximasListT & | img_maxima_points,
|  | TePDIMatrix< double > & | img_features_matrix,
|  | const std::string & | filenameaddon
| ) |  | `[static, protected]`

Save the generated features to tif files.

Parameters:

  corr_window_width | The correlation windows width.
  img_maxima_points | The image maxima points (these are the correlation matrix centers).
  img_features_matrix | The output image features matrix ( each line is a stacked version of one rotated correlation window ). A string to be appended to the file name of each feature file.

Returns:
  true if OK, false on errors.

void TePDIMMIOMatching::generateCorrelationFeatures | ( | void * | paramsPtr | ) | `[static, protected]`

Generate correlation features.

Parameters:

  paramsPtr | The parameters needed for the thread execution (a pointer to a ExtractLocalMaximasParams struct).

bool TePDIMMIOMatching::generateMaximasRaster | ( | const TePDIMtxDoubleAdptInt & | inputMatrix,
|  | const MaximasListT & | maximaPoints,
|  | TeRaster & | outRaster
| ) |  | `[static, protected]`

Generate the output maximas image ( 3 RGB bands where the maximas points are marked with value R255G0B0).

Parameters:

  inputMatrix | Input image data matrix.
  maximaPoints | Input maximas point list.
  outRaster | The ouptput raster.

Returns:
  true if ok, false on errors.

void TePDIMMIOMatching::loadImage | ( | void * | paramsPtr | ) | `[static, protected]`

A job function load raster data into a simple matrix.

Parameters:

  paramsPtr | The parameters needed for the thread execution (a pointer to a LoadImageParams struct).

bool TePDIMMIOMatching::matchFeatures | ( | FeatMatchingMethod | matching_method,
|  | const TePDIMatrix< double > & | img1featMtx,
|  | const MaximasListT & | img1_maximas_list,
|  | const TePDIMatrix< double > & | img2featMtx,
|  | const MaximasListT & | img2_maximas_list,
|  | TeCoordPairVect & | tiePointsVec,
|  | std::vector< double > & | tiePointsWeights
| ) |  | `[protected]`

Features matching and tie-points generation.

Parameters:

  matching_method | Features matching method.
  img1featMtx | Image 1 features matrix.
  img1_maximas_list | Image 1 maximas list.
  img2featMtx | Image 2 features matrix.
  img2_maximas_list | Image 2 maximas list.
  tiePointsVec | Output tie-points vector.
  tiePointsWeights | Output tie-points weights vector ( normalized between DBL_MIN and 1 ).

Returns:
  true if OK, false on errors.

void TePDIMMIOMatching::matrix2Tiff | ( | const TePDIMtxDoubleAdptInt & | input_matrix,
|  | const std::string & | out_file_name,
|  | const TeCoordPairVect & | tiepoints,
|  | bool | usePt1
| ) |  | `[static, protected]`

Save the output matrix to a geotiff file.

Parameters:

  input_matrix | Input matrix.
  out_file_name | Output file name.
  tiepoints | The tie oints to be filled with 255
  usePt1 | Use pt1 from tiepoints, otherwise use pt1

void TePDIMMIOMatching::matrix2Tiff | ( | const TePDIMtxDoubleAdptInt & | input_matrix,
|  | const std::string & | out_file_name,
|  | const MaximasListT & | maxima_points = `MaximasListT()`
| ) |  | `[static, protected]`

Save the output matrix to a geotiff file.

Parameters:

  input_matrix | Input matrix.
  out_file_name | Output file name.
  maxima_points | The maxima points to be filled with 255

void TePDIMMIOMatching::moravecRepeatability | ( | const MaximasListT & | inputList,
|  | const MaximasListT & | constraintList,
|  | unsigned int | constraintImageWidth,
|  | unsigned int | constraintImageHeight,
|  | double | moravecRepeatabilityMinTolerance,
|  | double | moravecReSampleFactor,
|  | MaximasListT & | outputList
| ) |  | `[protected]`

Applies a Moravec repeatability constraint over an image maximas list.

Parameters:

  inputList | Original image maximas list.
  constraintList | Constraint list.
  constraintImageWidth | Constraint image width.
  constraintImageHeight | Constraint image height.
  moravecRepeatabilityMinTolerance | Error tolerance (pixels)
  - constraint image reference.
  moravecReSampleFactor | Moravec resample factor (factor = inputList_scal / constraintList_scale).
  outputList | Output maximas list from input list.

void TePDIMMIOMatching::ResetState | ( | const TePDIParameters & | params | ) | `[protected, virtual]`

Reset the internal state to the initial state.

Parameters:

  params | The new parameters referente at initial state.

Implements TePDIAlgorithm.

bool TePDIMMIOMatching::RunImplementation | ( |  | ) | `[protected, virtual]`

Runs the current algorithm implementation.

Returns:
  true if OK. false on error.

Implements TePDIAlgorithm.

## Member Data Documentation

TeMutex TePDIMMIOMatching::globalMutex_`[protected]`

A global syncronization mutex.

TeThreadJobsManager TePDIMMIOMatching::jobsMan_`[protected]`

Internal threaded jobs manager.

const double TePDIMMIOMatching::moravecDownSampleFactor_`[protected]`

Moravec downsample factor = original_image / downsampled_image

const double TePDIMMIOMatching::moravecRepeatabilityMinTolerance_`[protected]`

Moravec repeatability tolerance

const double TePDIMMIOMatching::moravecUpSampleFactor_`[protected]`

Moravec upsample factor = original_image / upsampled_image

The documentation for this class was generated from the following files:

- E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/image_processing/TePDIMMIOMatching.hpp
- E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/image_processing/TePDIMMIOMatching.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines