Commit d1c45e82 authored by Antoine Regimbeau's avatar Antoine Regimbeau
Browse files

DOC: recipe on the cookbook

parent f8b07a54
No related merge requests found
Showing with 30 additions and 11 deletions
+30 -11
Documentation/Cookbook/Art/contrast1.png

54.5 KB | W: | H:

Documentation/Cookbook/Art/contrast1.png

56.1 KB | W: | H:

Documentation/Cookbook/Art/contrast1.png
Documentation/Cookbook/Art/contrast1.png
Documentation/Cookbook/Art/contrast1.png
Documentation/Cookbook/Art/contrast1.png
  • 2-up
  • Swipe
  • Onion skin
Documentation/Cookbook/Art/contrast2.png

87.4 KB | W: | H:

Documentation/Cookbook/Art/contrast2.png

89.2 KB | W: | H:

Documentation/Cookbook/Art/contrast2.png
Documentation/Cookbook/Art/contrast2.png
Documentation/Cookbook/Art/contrast2.png
Documentation/Cookbook/Art/contrast2.png
  • 2-up
  • Swipe
  • Onion skin
Documentation/Cookbook/Art/contrast3.png

54.5 KB | W: | H:

Documentation/Cookbook/Art/contrast3.png

56.1 KB | W: | H:

Documentation/Cookbook/Art/contrast3.png
Documentation/Cookbook/Art/contrast3.png
Documentation/Cookbook/Art/contrast3.png
Documentation/Cookbook/Art/contrast3.png
  • 2-up
  • Swipe
  • Onion skin
Documentation/Cookbook/Art/contrast4.png

11.1 KB | W: | H:

Documentation/Cookbook/Art/contrast4.png

15.3 KB | W: | H:

Documentation/Cookbook/Art/contrast4.png
Documentation/Cookbook/Art/contrast4.png
Documentation/Cookbook/Art/contrast4.png
Documentation/Cookbook/Art/contrast4.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -17,3 +17,4 @@ and demonstrate how the can be applied. ...@@ -17,3 +17,4 @@ and demonstrate how the can be applied.
recipes/featextract.rst recipes/featextract.rst
recipes/stereo.rst recipes/stereo.rst
recipes/bandmathx.rst recipes/bandmathx.rst
recipes/contrast_enhancement.rst
...@@ -8,21 +8,28 @@ The contrast enhancement application is aiming at reducing this dynamic ...@@ -8,21 +8,28 @@ The contrast enhancement application is aiming at reducing this dynamic
by compressing it in a smarter way than just linear compression. by compressing it in a smarter way than just linear compression.
In a linear compression, compression changes the dynamic range (for instance In a linear compression, compression changes the dynamic range (for instance
from 12 to 8 bits) but does not change the repartition of the pixel. from 12 to 8 bits) but does not change the repartition of the pixel.
|image1| |image2| |image1| |image2|
.. |image1| image:: ../Art/contrast1.png Here the equalization of histogram is creating a look up table in order to
maximize the use of dynamics. The target histogram is perfectly flat one.
The gain applied on each pixel comes from the computation of the transfer
function :math:`T` such that :
.. |image2| image:: ../Art/contrast2.png .. math:: \forall i \quad \int_{min}^{i*T(i)}h_{istogram}(j)dj =
\int_{min}^{i}h_{target}(j)dj
Here the equalization of histogram is creating a look up table in order to where :math:`h_{target}` is the corresponding flat histogram and we have
maximize the use of dynamics. the constraint that white and black are still white and black after
equalization :
..image::../Art/contrast3.png .. math:: T(min) = T(max) = 1
With this in mind you can then try it on your own images with the simple With this in mind you can then try it on your own images with the simple
following use : following use :
:: ::
otbcli_ContrastEnhancement -in input_image.tif otbcli_ContrastEnhancement -in input_image.tif
-out output_image.tif -out output_image.tif
-spatial global -spatial global
...@@ -46,10 +53,11 @@ computed over those tiles. Gain will be interpolated between the adjacent ...@@ -46,10 +53,11 @@ computed over those tiles. Gain will be interpolated between the adjacent
tiles in order to give a smooth result. tiles in order to give a smooth result.
:: ::
otbcli_ContrastEnhancement -in input_image.tif
-out output_image.tif otbcli_ContrastEnhancement -in input_image.tif
-spatial.local.h 500 -out output_image.tif
-spatial.local.w 500 -spatial.local.h 500
-spatial.local.w 500
-mode lum -mode lum
The application also offers a way to limit contrast by adjusting original The application also offers a way to limit contrast by adjusting original
...@@ -58,9 +66,19 @@ any bucket of the histogram : we compute the height of the perfect flat ...@@ -58,9 +66,19 @@ any bucket of the histogram : we compute the height of the perfect flat
histogram and the maximal height is the limitation factor time this "flat histogram and the maximal height is the limitation factor time this "flat
height". height".
..image::../Art/contrast4.png |image4|
Finally you have the choice to ignore a particular value with the "nodata" Finally you have the choice to ignore a particular value with the "nodata"
parameter, and also the choice to put manually your minimum and maximum value. parameter, and also the choice to put manually your minimum and maximum value.
Any value out of bound will be ignored. Any value out of bound will be ignored.
.. |image1| image:: ../Art/contrast1.png
:scale: 30%
.. |image2| image:: ../Art/contrast2.png
:scale: 30%
.. |image3| image:: ../Art/contrast3.png
:scale: 40%
.. |image4| image:: ../Art/contrast4.png
\ No newline at end of file
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