Commit 6775c1ae authored by Yannick TANGUY's avatar Yannick TANGUY Committed by Yannick TANGUY
Browse files

Improve documentation (luminance mode)

No related merge requests found
Showing with 20 additions and 39 deletions
+20 -39
...@@ -154,7 +154,7 @@ private: ...@@ -154,7 +154,7 @@ private:
"or to reduce the dynamic of the image without losing too much contrast. " "or to reduce the dynamic of the image without losing too much contrast. "
"It offers several options as a no data value, " "It offers several options as a no data value, "
"a contrast limitation factor, a local version of the algorithm and " "a contrast limitation factor, a local version of the algorithm and "
"also a mode to equalized the luminance of the image."); "also a mode to equalize the luminance of the image.");
// Documentation // Documentation
SetDocName("Contrast Enhancement"); SetDocName("Contrast Enhancement");
...@@ -164,13 +164,14 @@ private: ...@@ -164,13 +164,14 @@ private:
"over the image and then use the whole dynamic : meaning flattening the " "over the image and then use the whole dynamic : meaning flattening the "
"histogram. That gives us gain for each bin that transform the original " "histogram. That gives us gain for each bin that transform the original "
"histogram into the flat one. This gain is then apply on the original " "histogram into the flat one. This gain is then apply on the original "
"image. Upon this coarse algorithm we added several option to allow " "image."
"a finer result. First there is the limitation of the contrast. Many " "\nThe application proposes several option to allow a finer result : "
"ways can be used to do it, we choose to limit the contrast by modifying " "\n- There is an option to limit contrast. We choose to limit the contrast "
"the original histogram. To do so we clip the histogram at a given " "by modifying the original histogram. To do so we clip the histogram at a "
"height and redistribute equally among the bins the clipped population. " "given height and redistribute equally among the bins the clipped population. "
"Then we add a local version of the algorithm. It is possible to apply " "Then we add a local version of the algorithm. "
"the algorithm on tiles of the image. That gives us gain depending on " "\n- It is possible to apply the algorithm on tiles of the image, instead "
"of on the whole image. That gives us gain depending on "
"the value of the pixel and its position in the image. In order to " "the value of the pixel and its position in the image. In order to "
"smoothen the result we interpolate the gain between tiles."); "smoothen the result we interpolate the gain between tiles.");
SetDocLimitations("None"); SetDocLimitations("None");
...@@ -195,7 +196,8 @@ private: ...@@ -195,7 +196,8 @@ private:
"height accepted in a bin on the input image histogram. " "height accepted in a bin on the input image histogram. "
"The maximum height will be computed as hfact*eqHeight where eqHeight " "The maximum height will be computed as hfact*eqHeight where eqHeight "
"is the height of the theoretical flat histogram. The higher hfact, the " "is the height of the theoretical flat histogram. The higher hfact, the "
"higher the contrast."); "higher the contrast."
"\nWhen using 'luminance mode', it is recommended to limit this factor to a small value (ex : 4)");
MandatoryOff("hfact"); MandatoryOff("hfact");
AddParameter(ParameterType_Float , "nodata" , "Nodata Value"); AddParameter(ParameterType_Float , "nodata" , "Nodata Value");
...@@ -208,7 +210,7 @@ private: ...@@ -208,7 +210,7 @@ private:
"for the histogram computation"); "for the histogram computation");
AddChoice( "spatial.local" , "Local" ); AddChoice( "spatial.local" , "Local" );
SetParameterDescription("spatial.local" , "The histograms will be " SetParameterDescription("spatial.local" , "The histograms will be "
"computed on the each thumbnail. Each of the histogram will be " "computed on each thumbnail. Each of the histogram will be "
"equalized and the corresponding gain will be interpolated."); "equalized and the corresponding gain will be interpolated.");
AddChoice( "spatial.global" , "Global" ); AddChoice( "spatial.global" , "Global" );
SetParameterDescription("spatial.global" , "The histogram will be " SetParameterDescription("spatial.global" , "The histogram will be "
...@@ -247,9 +249,14 @@ private: ...@@ -247,9 +249,14 @@ private:
"Each channel is equalized independently" ); "Each channel is equalized independently" );
AddChoice( "mode.lum" , "Luminance" ); AddChoice( "mode.lum" , "Luminance" );
SetParameterDescription( "mode.lum" , SetParameterDescription( "mode.lum" ,
"The luminance is equalized and then a gain is applied " "The relative luminance is calculated thanks to the coefficients."
"on each channels. This gain for each channels will depend on" "Then the histogram is equalized and then a gain is applied on each channels."
"the weight (coef) of the channel in the luminance." ); "This gain for each channels will depend on"
"the weight (coef) of the channel in the luminance."
"\nNote that default values come from color space theories "
"on how human eyes perceive colors)"
);
AddParameter(ParameterType_Group , "mode.lum.red" , "Red Channel" ); AddParameter(ParameterType_Group , "mode.lum.red" , "Red Channel" );
AddParameter(ParameterType_Int , "mode.lum.red.ch" , "Red Channel" ); AddParameter(ParameterType_Int , "mode.lum.red.ch" , "Red Channel" );
SetDefaultParameterInt("mode.lum.red.ch", 0 ); SetDefaultParameterInt("mode.lum.red.ch", 0 );
...@@ -300,12 +307,6 @@ private: ...@@ -300,12 +307,6 @@ private:
FloatVectorImageType::RegionType::SizeType size; FloatVectorImageType::RegionType::SizeType size;
size = inImage->GetLargestPossibleRegion().GetSize() ; size = inImage->GetLargestPossibleRegion().GetSize() ;
// if ( !HasUserValue("spatial.local.w") )
// SetParameterInt( "spatial.local.w" , size[0] );
// if ( !HasUserValue("spatial.local.h") )
// SetParameterInt( "spatial.local.h" , size[1] );
if ( GetParameterString("spatial") == "local" && if ( GetParameterString("spatial") == "local" &&
HasValue("spatial.local.h") && HasValue("spatial.local.w") && HasValue("spatial.local.h") && HasValue("spatial.local.w") &&
HasValue("bins") ) HasValue("bins") )
...@@ -320,26 +321,6 @@ private: ...@@ -320,26 +321,6 @@ private:
!HasUserValue("mode.lum.green.ch") && !HasUserValue("mode.lum.green.ch") &&
!HasUserValue("mode.lum.blue.ch") ) !HasUserValue("mode.lum.blue.ch") )
SetDefaultValue( inImage , "RGB" ); SetDefaultValue( inImage , "RGB" );
// if ( HasUserValue("minmax.manuel.min") &&
// HasUserValue("minmax.manuel.max") )
// {
// if ( GetParameterFloat( "minmax.manuel.min" ) >
// GetParameterFloat( "minmax.manuel.max" ) )
// {
// float temp = GetParameterFloat( "minmax.manuel.min" );
// SetParameterFloat( "minmax.manuel.min" ,
// GetParameterFloat( "minmax.manuel.max" ));
// SetParameterFloat( "minmax.manuel.max" , temp );
// }
// else if ( GetParameterFloat( "minmax.manuel.min" ) ==
// GetParameterFloat( "minmax.manuel.max" ) )
// {
// std::ostringstream oss;
// oss<<"Warning minimum and maximum are equal."<<std::endl;
// otbAppLogINFO( << oss.str() );
// }
// }
} }
if ( GetParameterString("minmax") == "manuel" ) if ( GetParameterString("minmax") == "manuel" )
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment