| TerraLib 4.1

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

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

Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions
TePDIOFMatching Class Reference
Image matching algorithms.

Optical flow based image area matching. More...

`#include <TePDIOFMatching.hpp>`

Inheritance diagram for TePDIOFMatching:

List of all members.

## Public Member Functions

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

## Protected Types

typedef TePDIMatrix< double > | ImgMatrixT
| A type definition for a image matrix.

## Protected Member Functions

bool | RunImplementation ()
| Runs the current algorithm implementation.
void | ResetState (const TePDIParameters &params)
| Reset the internal state to the initial state.
bool | checkMaximaPoints (const std::vector< TeCoord2D > &maximas) const
| Check maxima points for repeated values.
bool | checkTPs (const TeCoordPairVect &tpsvec) const
| Check tie-points indexes for repeated values.

## Static Protected Member Functions

static bool | loadImage (const TeThreadParameters &params)
| A thread entry point to load raster data into a simple matrix.
static bool | generateFeatures (const TeThreadParameters &params)
| A thread entry point to generate the image features and the maxima points.
static bool | gaussianSmoothing (const ImgMatrixT &input_matrix, ImgMatrixT &output_matrix, unsigned int iterations, bool progress_enabled, TeMutex &glb_mem_lock)
| Apply a gaussian smoothing over the input_matrix.
static bool | generateLSSurface (const ImgMatrixT &input_matrix, ImgMatrixT &ls_surface_matrix, bool progress_enabled, TeMutex &glb_mem_lock)
| Generates a least squares surface from the input matrix.
static void | matrix2Tiff (const ImgMatrixT &input_matrix, const std::string &out_file_name, const std::vector< TeCoord2D > &maxima_points)
| Save the output matrix to a geotiff file.
static void | raster2Tiff (const TePDITypes::TePDIRasterPtrType &input_raster_ptr, unsigned int raster_channel, const std::string &out_file_name, const std::vector< TeCoord2D > &maxima_points, const TeSharedPtr< TeCoordPairVect > &out_tie_points_ptr, unsigned int tie_points_space)
| Save the output matrix to a geotiff file.
static bool | getMaximaPoints (const ImgMatrixT &input_matrix, std::vector< TeCoord2D > &maxima_points, unsigned int max_points, unsigned int corr_window_width, bool progress_enabled, double maximas_sens)
| Get image local maxima points.
static bool | generateCorrWindows (const ImgMatrixT &img_matrix, unsigned int corr_window_width, const std::vector< TeCoord2D > &img_maxima_points, ImgMatrixT &img_features_matrix, bool progress_enabled, TeMutex &glb_mem_lock)
| Generate the rotated normalized corelation windows matrix.
static void | features2Tiff (unsigned int corr_window_width, const std::vector< TeCoord2D > &img_maxima_points, ImgMatrixT &img_features_matrix, const std::string &filenameaddon)
| Save the generated features to tif files.
static bool | locateBestFeaturesMatching (const TeThreadParameters &params)
| A thread entry point to locate the best features matching index on matrix 2 from each feature on matrix 1.

## Detailed Description

Optical flow 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:

  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; Some TeDecoders do not support multi-thread so use it with cation (default: multi-thread disabled).
  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);
  max_tie_points | (unsigned int) - The maximum number of generated tie-points (default=529);
  skip_geom_filter | (int) - If present (any value) will disable the geometric filtering ( default: geometric filtering enabled ).
  corr_sens | (double) - The correlation sensibility (default: 0.5 range: (0,3] ).
  corr_window_width | (unsigned int) - The correlation window width used to correlate points between images (Must be an odd number, minimum 3, default: 21).
  max_size_opt | (unsigned int) - The maximum image box allowed size (size = pixels number = lines * columns); when the images pixels number exceed this value a downsample will be performed for optimization (default value=0 wich means optimization disabled).
  maximas_sens | (double) - The maximas (candidate tie-points) detection sensibility (default: 0 range: [0,1] ).

Examples:

  TePDIOFMatching_test.cpp.

## Member Typedef Documentation

TePDIMatrix< double > TePDIOFMatching::ImgMatrixT`[protected]`

A type definition for a image matrix.

## Constructor & Destructor Documentation

TePDIOFMatching::TePDIOFMatching | ( |  | ) |

Default Constructor.

TePDIOFMatching::~TePDIOFMatching | ( |  | ) |

Default Destructor.

## Member Function Documentation

bool TePDIOFMatching::checkMaximaPoints | ( | const std::vector< TeCoord2D > & | maximas | ) | const`[protected]`

Check maxima points for repeated values.

Parameters:

  maximas | Maxima points vector.

Returns:
  true if OK, false on errors.

bool TePDIOFMatching::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.

bool TePDIOFMatching::checkTPs | ( | const TeCoordPairVect & | tpsvec | ) | const`[protected]`

Check tie-points indexes for repeated values.

Parameters:

  maximas | Tie-points vector.

Returns:
  true if OK, false on errors.

void TePDIOFMatching::features2Tiff | ( | unsigned int | corr_window_width,
|  | const std::vector< TeCoord2D > & | img_maxima_points,
|  | ImgMatrixT & | 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.

bool TePDIOFMatching::gaussianSmoothing | ( | const ImgMatrixT & | input_matrix,
|  | ImgMatrixT & | output_matrix,
|  | unsigned int | iterations,
|  | bool | progress_enabled,
|  | TeMutex & | glb_mem_lock
| ) |  | `[static, protected]`

Apply a gaussian smoothing over the input_matrix.

Parameters:

  input_matrix | Input matrix.
  output_matrix | Output matrix.
  iterations | Iterations number.
  progress_enabled | Progress interface enabled.
  glb_mem_lock | a Reference to the global memory allocation mutex.

Returns:
  true if OK, false on errors.

bool TePDIOFMatching::generateCorrWindows | ( | const ImgMatrixT & | img_matrix,
|  | unsigned int | corr_window_width,
|  | const std::vector< TeCoord2D > & | img_maxima_points,
|  | ImgMatrixT & | img_features_matrix,
|  | bool | progress_enabled,
|  | TeMutex & | glb_mem_lock
| ) |  | `[static, protected]`

Generate the rotated normalized corelation windows matrix.

Parameters:

  img_matrix | Input image matrix.
  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 ).
  progress_enabled | Progress interface enabled.
  glb_mem_lock | a Reference to the global memory allocation mutex.

Returns:
  true if OK, false on errors.

bool TePDIOFMatching::generateFeatures | ( | const TeThreadParameters & | params | ) | `[static, protected]`

A thread entry point to generate the image features and the maxima points.

Parameters:

  params | The parameters needed for the thread execution.

Returns:
  true if OK, false on errors.

Note:
  The points inside img_maxima_points_ptr will have img_matrix_ptr reference.

bool TePDIOFMatching::generateLSSurface | ( | const ImgMatrixT & | input_matrix,
|  | ImgMatrixT & | ls_surface_matrix,
|  | bool | progress_enabled,
|  | TeMutex & | glb_mem_lock
| ) |  | `[static, protected]`

Generates a least squares surface from the input matrix.

Parameters:

  input_matrix | Input matrix.
  ls_surface_matrix | Output matrix containing the LS surface.
  progress_enabled | Progress interface enabled.
  glb_mem_lock | a Reference to the global memory allocation mutex.

Returns:
  true if OK, false on errors.

bool TePDIOFMatching::getMaximaPoints | ( | const ImgMatrixT & | input_matrix,
|  | std::vector< TeCoord2D > & | maxima_points,
|  | unsigned int | max_points,
|  | unsigned int | corr_window_width,
|  | bool | progress_enabled,
|  | double | maximas_sens
| ) |  | `[static, protected]`

Get image local maxima points.

Parameters:

  input_matrix | Input matrix.
  maxima_points | The generated points.
  max_points | The maximum number of generated points.
  corr_window_width | The correlation window width (points outside the correlation window based valid image bounds will not be generated ).
  progress_enabled | Progress interface enabled.
  maximas_sens | Maximas sensibility to blocks mean ( block mean diff >= max blocks mean diff * maximas_sens )

Returns:
  true if OK, false on errors.

bool TePDIOFMatching::loadImage | ( | const TeThreadParameters & | params | ) | `[static, protected]`

A thread entry point to load raster data into a simple matrix.

Parameters:

  params | The parameters needed for the thread execution.

Returns:
  true if OK, false on errors.

bool TePDIOFMatching::locateBestFeaturesMatching | ( | const TeThreadParameters & | params | ) | `[static, protected]`

A thread entry point to locate the best features matching index on matrix 2 from each feature on matrix 1.

Parameters:

  params | The parameters needed for the thread execution.

Returns:
  true if OK, false on errors.

Note:
  The internal used parameters:

Parameters:

  features2_indexes_ptr | (std::vector< unsigned int >*) A pointer the the empty vector where the generated features matrix 2 indexes will be stored.
  features2_indexes_lock_ptr | (TeMutex*) A thread lock object to access features2_indexes_ptr.
  img1_features_matrix_ptr | (ImgMatrixT*) A pointer to the image 1 features matrix.
  img2_features_matrix_ptr | (ImgMatrixT*) A pointer to the image 2 features matrix.
  progress_enabled | (bool) Progress enabled flag.
  corr_sens | (double) Correlation sensitivity.

void TePDIOFMatching::matrix2Tiff | ( | const ImgMatrixT & | input_matrix,
|  | const std::string & | out_file_name,
|  | const std::vector< TeCoord2D > & | maxima_points
| ) |  | `[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 TePDIOFMatching::raster2Tiff | ( | const TePDITypes::TePDIRasterPtrType & | input_raster_ptr,
|  | unsigned int | raster_channel,
|  | const std::string & | out_file_name,
|  | const std::vector< TeCoord2D > & | maxima_points,
|  | const TeSharedPtr< TeCoordPairVect > & | out_tie_points_ptr,
|  | unsigned int | tie_points_space
| ) |  | `[static, protected]`

Save the output matrix to a geotiff file.

Parameters:

  input_raster | Input raster.
  raster_channel | Raster channel.
  out_file_name | Output file name.
  maxima_points | The maxima points to be drawed.
  out_tie_points_ptr | The tie-points to be drawed.
  tie_points_space | The tie-points space (pt1 or pt2).

void TePDIOFMatching::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 TePDIOFMatching::RunImplementation | ( |  | ) | `[protected, virtual]`

Runs the current algorithm implementation.

Returns:
  true if OK. false on error.

Implements TePDIAlgorithm.

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

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

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines