| TerraLib 4.1

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

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

Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
TePDIContrast Class Reference
Image enhancement algorithms.

This is the class for contrast image processing algorithms. More...

`#include <TePDIContrast.hpp>`

Inheritance diagram for TePDIContrast:

List of all members.

## Public Types

enum | TePDIContrastType { TePDIContrastMinMax = 1, TePDIContrastLinear = 2, TePDIContrastSquareRoot = 3, TePDIContrastSquare = 4, TePDIContrastLog = 5, TePDIContrastNegative = 6, TePDIContrastHistEqualizer = 7, TePDIContrastSimpleSlicer = 8, TePDIContrastStat = 9 }

## Public Member Functions

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

## Protected Member Functions

bool | RunImplementation ()
| Runs the current algorithm implementation.
void | ResetState (const TePDIParameters &params)
| Reset the internal state to the initial state.
TePDITypes::TePDILutType | GetMinMaxLut (double channel_min_level, double channel_max_level, TePDITypes::TePDILutType &base_lut)
| Build a min-max look-up table.
TePDITypes::TePDILutType | GetLinearLut (TePDITypes::TePDILutType &base_lut, double min, double max, double channel_min_level, double channel_max_level)
| Build a Linear look-up table.
TePDITypes::TePDILutType | GetSquareRootLut (TePDITypes::TePDILutType &base_lut, double min, double max, double channel_min_level, double channel_max_level)
| Build a Square Root look-up table.
TePDITypes::TePDILutType | GetSquareLut (TePDITypes::TePDILutType &base_lut, double min, double max, double channel_min_level, double channel_max_level)
| Build a Square look-up table.
TePDITypes::TePDILutType | GetLogLut (TePDITypes::TePDILutType &base_lut, double min, double max, double channel_min_level, double channel_max_level)
| Build a Log look-up table.
TePDITypes::TePDILutType | GetNegativeLut (TePDITypes::TePDILutType &base_lut, double min, double max, double channel_min_level, double channel_max_level)
| Build a Negative look-up table.
TePDITypes::TePDILutType | GetHistEqualizerLut (TePDIHistogram::pointer hist, double channel_min_level, double channel_max_level)
| Build a Histogram equalizer look-up table.
void | GetSimpleSlicerLut (TePDIHistogram::pointer hist, TePDIRgbPalette::pointer in_palette, double min, double max, TePDITypes::TePDILutType &out_lut)
| Builds a Simple slicer look-up table.
void | GetStatLut (TePDIHistogram::pointer hist, double target_mean, double target_variance, double channel_min_level, double channel_max_level, TePDITypes::TePDILutType &out_lut)
| Builds a mean and variance normalization lut.
bool | RemapLevels (TePDITypes::TePDIRasterPtrType &inRaster, TePDITypes::TePDILutType &lut, int in_channel, int out_channel, TePDITypes::TePDIRasterPtrType &outRaster, bool use_dummy, double dummy_value, bool fixed_step_lut)
| Do level remapping from one raster to another.
bool | FullRangeLutRemapLevels (TePDITypes::TePDIRasterPtrType &inRaster, TePDITypes::TePDILutType &lut, int in_channel, int out_channel, TePDITypes::TePDIRasterPtrType &outRaster, bool use_dummy, double dummy_value)
| Do level remapping from one raster to another.
bool | getHistogram (TePDIHistogram::pointer &hist, bool useDummy, double dummyValue)
| Returns a valid histogram using the given algorithm input parameters.
bool | getBaseLut (TePDITypes::TePDILutType &lut, bool &hist_based_lut, bool useDummy, double dummyValue)
| Returns valid dummy base lut from the given algorithm input parameters.

## Protected Attributes

TePDIHistogram::pointer | histo_ptr_
| A pointer to the current generated histogram.

## Detailed Description

This is the class for contrast image processing algorithms.

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

Note:
  The general input parameters are:

Parameters:

  contrast_type | ( TePDIContrast::TePDIContrastType ) - The contrast to be generated.
  input_image | (TePDITypes::TePDIRasterPtrType) - The input image.
  input_band | ( int ) - Band to process from input_image.

Note:
  The specific input parameters ( by parameter type ):

Parameters:

  min_level | (double) - Minimal level for Linear Luts. Required by: TePDIContrastLinear, TePDIContrastSquareRoot, TePDIContrastSquare, TePDIContrastLog, TePDIContrastNegative, TePDIContrastSimpleSlicer.
  max_level | (double) - Minimal level for Linear Luts. Required by: TePDIContrastLinear, TePDIContrastSquareRoot, TePDIContrastSquare, TePDIContrastLog, TePDIContrastNegative, TePDIContrastSimpleSlicer.
  rgb_palette | (TePDIRgbPalette::pointer) - Reference RGB palette. Required by: TePDIContrastSimpleSlicer.
  target_mean | ( double ) - The target mean value. Required by: TePDIContrastStat.
  target_variance | ( double ) - The target variance value. Required by: TePDIContrastStat.

Note:
  The following parameters are optional and will be used if present.

Parameters:

  output_image | ( TePDITypes::TePDIRasterPtrType ) - The output image ( if not present, only the output LUT will be generated ).
  output_band | ( int ) - Band to save the result inside output_image (required if output_image is present).
  restrict_out_reset | (int) - If present (any value), a restrictive output_image reset will be done ( output_image reset will not be done if all of the following conditions are satisfied - Exact number of lines, exact number of columns, sufficient number of bands, same projection, same box, dummy value ), this allows output_image data keeping since unused bands are not changed.
  outlut | ( TePDITypes::TePDILutPtrType ) - The generated look-up table. NOTE: If the current input_image has floating point pixel values, the generated look-up table will have interpolated values.
  input_histogram | ( TePDIHistogram::pointer ) - A pointer to an active histogram instance that will be used when generating the internal lut - The internal histogram generation will be disabled.
  output_original_histogram | ( TePDIHistogram::pointer ) - A pointer to an active output histogram instance that will be filled with the internally generated histogram from the input image or using the supplied input histogram.
  output_enhanced_histogram | ( TePDIHistogram::pointer ) - A pointer to an active output histogram instance that will be filled with the internally generated histogram from the input image or using the supplied input histogram.
  histo_levels | (int) - Number of histogram levels when internal histogram generation is needed ( if zero, the histogram levels will be automatically found. In this case, for floating point rasters the number of levels will be always 256 ).
  dummy_value | (double) - A dummy pixel value for use in pixels where no data is available.
  input_mean | ( double ) - Force the algorithm to use the supplied value as mean for the current raster (The internal mean calcule will be disabled ). Used by: TePDIContrastStat.
  input_variance | ( double ) - Force the algorithm to use the supplied value as variance for the current raster ( The internal variance calcule will be disabled ). Used by: TePDIContrastStat.
  output_channel_min_level | ( double ) - Force the miminum output gray level to be the supplied value (required if output_image is not present).
  output_channel_max_level | ( double ) - Force the maximum output gray level to be the supplied value (required if output_image is not present).

Examples:

  TePDIContrast_test.cpp.

## Member Enumeration Documentation

enum TePDIContrast::TePDIContrastType

Enumerator:

  TePDIContrastMinMax | The histogram range will be changed to the supplied min/max range ( linear function ).
  TePDIContrastLinear | The histogram will be remapped using a linear function.
  TePDIContrastSquareRoot | The histogram will be remapped using a square root function.
  TePDIContrastSquare | The histogram will be remapped using a square function.
  TePDIContrastLog | The histogram will be remapped using a logarithmic function.
  TePDIContrastNegative | The histogram will be remapped using a linear inverse function.
  TePDIContrastHistEqualizer | The uniform histogram aproximation.
  TePDIContrastSimpleSlicer | The histogram values will be splitted into slices and linked with a RGB color table.
  TePDIContrastStat | Image mean and variance uniformization.

## Constructor & Destructor Documentation

TePDIContrast::TePDIContrast | ( |  | ) |

Default Constructor.

TePDIContrast::~TePDIContrast | ( |  | ) |

Default Destructor.

## Member Function Documentation

bool TePDIContrast::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 TePDIContrast::FullRangeLutRemapLevels | ( | TePDITypes::TePDIRasterPtrType & | inRaster,
|  | TePDITypes::TePDILutType & | lut,
|  | int | in_channel,
|  | int | out_channel,
|  | TePDITypes::TePDIRasterPtrType & | outRaster,
|  | bool | use_dummy,
|  | double | dummy_value
| ) |  | `[protected]`

Do level remapping from one raster to another.

Note:
  For luts having full channel range (contains mappings for all possible ordered gray scale values, starting from zero ).

Parameters:

  inRaster | The input Raster.
  outRaster | The Output Raster.
  lut | The increasing level-ordered look-up table.
  in_channel | in_raster channel to remap.
  out_channel | out_raster channel to write on.
  use_dummy | Force a new dummy value use ( input pixels with dummy values will be ignored ).
  dummy_value | A dummy pixel value for use in pixels where no data is available.

Returns:
  true if ok, false on errors.

bool TePDIContrast::getBaseLut | ( | TePDITypes::TePDILutType & | lut,
|  | bool & | hist_based_lut,
|  | bool | useDummy,
|  | double | dummyValue
| ) |  | `[protected]`

Returns valid dummy base lut from the given algorithm input parameters.

Note:
  The dummy lut contains dummy mappings for all grey levels following the algorithm input parameters.

Parameters:

  lut | The generated dummy lut.
  hist_based_lut | This parameter will be false if the generated lut has all possible gray levels ( including the unused ones ), true value means that the lut was build using the image histogram wich may contain only the used gray values or the interpolated values.
  useDummy | A flag indicating when a dummy value must be used.
  dummyValue | The dummy value that must be used.

Returns:
  true if ok, false on errors.

TePDITypes::TePDILutType TePDIContrast::GetHistEqualizerLut | ( | TePDIHistogram::pointer | hist,
|  | double | channel_min_level,
|  | double | channel_max_level
| ) |  | `[protected]`

Build a Histogram equalizer look-up table.

Parameters:

  channel_min_level | The minimum channel possible level value.
  channel_max_level | The maximum channel possible level value.
  hist | A LEVEL-ORDERED Base histogram.

Returns:
  The look-up table.

bool TePDIContrast::getHistogram | ( | TePDIHistogram::pointer & | hist,
|  | bool | useDummy,
|  | double | dummyValue
| ) |  | `[protected]`

Returns a valid histogram using the given algorithm input parameters.

Parameters:

  hist | The generated Histogram.
  useDummy | A flag indicating when a dummy value must be used.
  dummyValue | The dummy value that must be used.

Returns:
  true if ok, false on errors.

TePDITypes::TePDILutType TePDIContrast::GetLinearLut | ( | TePDITypes::TePDILutType & | base_lut,
|  | double | min,
|  | double | max,
|  | double | channel_min_level,
|  | double | channel_max_level
| ) |  | `[protected]`

Build a Linear look-up table.

Parameters:

  min | Minimal level value.
  max | Maximum level value.
  channel_min_level | The minimum channel possible level value.
  channel_max_level | The maximum channel possible level value.
  base_lut | Base lut.

Returns:
  The look-up table.

TePDITypes::TePDILutType TePDIContrast::GetLogLut | ( | TePDITypes::TePDILutType & | base_lut,
|  | double | min,
|  | double | max,
|  | double | channel_min_level,
|  | double | channel_max_level
| ) |  | `[protected]`

Build a Log look-up table.

Parameters:

  min | Minimal level value.
  max | Maximum level value.
  channel_min_level | The minimum channel possible level value.
  channel_max_level | The maximum channel possible level value.
  base_lut | Base lut.

Returns:
  The look-up table.

TePDITypes::TePDILutType TePDIContrast::GetMinMaxLut | ( | double | channel_min_level,
|  | double | channel_max_level,
|  | TePDITypes::TePDILutType & | base_lut
| ) |  | `[protected]`

Build a min-max look-up table.

Parameters:

  channel_min_level | The minimum channel possible level value.
  channel_max_level | The maximum channel possible level value.
  base_lut | Base lut.

Returns:
  The look-up table.

TePDITypes::TePDILutType TePDIContrast::GetNegativeLut | ( | TePDITypes::TePDILutType & | base_lut,
|  | double | min,
|  | double | max,
|  | double | channel_min_level,
|  | double | channel_max_level
| ) |  | `[protected]`

Build a Negative look-up table.

Parameters:

  min | Minimal level value.
  max | Maximum level value.
  channel_min_level | The minimum channel possible level value.
  channel_max_level | The maximum channel possible level value.
  base_lut | Base lut.

Returns:
  The look-up table.

void TePDIContrast::GetSimpleSlicerLut | ( | TePDIHistogram::pointer | hist,
|  | TePDIRgbPalette::pointer | in_palette,
|  | double | min,
|  | double | max,
|  | TePDITypes::TePDILutType & | out_lut
| ) |  | `[protected]`

Builds a Simple slicer look-up table.

Parameters:

  hist | A LEVEL-ORDERED Base histogram.
  in_palette | The reference RGB palette.
  min | Minimal level value.
  max | Maximum level value.
  out_lut | The look-up table.

TePDITypes::TePDILutType TePDIContrast::GetSquareLut | ( | TePDITypes::TePDILutType & | base_lut,
|  | double | min,
|  | double | max,
|  | double | channel_min_level,
|  | double | channel_max_level
| ) |  | `[protected]`

Build a Square look-up table.

Parameters:

  min | Minimal level value.
  max | Maximum level value.
  channel_min_level | The minimum channel possible level value.
  channel_max_level | The maximum channel possible level value.
  base_lut | Base lut.

Returns:
  The look-up table.

TePDITypes::TePDILutType TePDIContrast::GetSquareRootLut | ( | TePDITypes::TePDILutType & | base_lut,
|  | double | min,
|  | double | max,
|  | double | channel_min_level,
|  | double | channel_max_level
| ) |  | `[protected]`

Build a Square Root look-up table.

Parameters:

  min | Minimal level value.
  max | Maximum level value.
  channel_min_level | The minimum channel possible level value.
  channel_max_level | The maximum channel possible level value.
  base_lut | Base lut.

Returns:
  The look-up table.

void TePDIContrast::GetStatLut | ( | TePDIHistogram::pointer | hist,
|  | double | target_mean,
|  | double | target_variance,
|  | double | channel_min_level,
|  | double | channel_max_level,
|  | TePDITypes::TePDILutType & | out_lut
| ) |  | `[protected]`

Builds a mean and variance normalization lut.

Parameters:

  hist | A LEVEL-ORDERED Base histogram.
  target_mean | The target mean value.
  target_variance | The target variance value.
  channel_min_level | The minimum channel possible level value.
  channel_max_level | The maximum channel possible level value.
  out_lut | The look-up table.

bool TePDIContrast::RemapLevels | ( | TePDITypes::TePDIRasterPtrType & | inRaster,
|  | TePDITypes::TePDILutType & | lut,
|  | int | in_channel,
|  | int | out_channel,
|  | TePDITypes::TePDIRasterPtrType & | outRaster,
|  | bool | use_dummy,
|  | double | dummy_value,
|  | bool | fixed_step_lut
| ) |  | `[protected]`

Do level remapping from one raster to another.

Parameters:

  inRaster | The input Raster.
  outRaster | The Output Raster.
  lut | The increasing level-ordered look-up table.
  in_channel | in_raster channel to remap.
  out_channel | out_raster channel to write on.
  use_dummy | Force a new dummy value use ( input pixels with dummy values will be ignored ).
  dummy_value | A dummy pixel value for use in pixels where no data is avaliable.
  fixed_step_lut | A flag indication of a fixed step lut ( the internal optimized fixed step algorithm will be used )

Returns:
  true if ok, false on errors.

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

Runs the current algorithm implementation.

Returns:
  true if OK. false on error.

Implements TePDIAlgorithm.

## Member Data Documentation

TePDIHistogram::pointer TePDIContrast::histo_ptr_`[protected]`

A pointer to the current generated histogram.

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

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

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines