Commit 247c74e5 authored by Victor Poughon's avatar Victor Poughon
Browse files

DOC: review ScalingFilterExample

No related merge requests found
Showing with 24 additions and 25 deletions
+24 -25
Data/Output/QB_Toulouse_Ortho_PAN_casted.png

131 Bytes

Data/Output/QB_Toulouse_Ortho_PAN_rescaled.png

131 Bytes

...@@ -23,13 +23,6 @@ ...@@ -23,13 +23,6 @@
./ScalingFilterExample Input/QB_Toulouse_Ortho_PAN.tif Output/QB_Toulouse_Ortho_PAN_rescaled.png Output/QB_Toulouse_Ortho_PAN_casted.png ./ScalingFilterExample Input/QB_Toulouse_Ortho_PAN.tif Output/QB_Toulouse_Ortho_PAN_rescaled.png Output/QB_Toulouse_Ortho_PAN_casted.png
*/ */
// On one hand, satellite images are commonly coded on more than 8 bits to provide
// the dynamic range required from shadows to clouds. On the other hand, image formats
// in use for printing and display are usually limited to 8 bits. We need to convert the value
// to enable a proper display. This is usually done using linear scaling. Of course, you have
// to be aware that some information is lost in the process.
#include "otbImage.h" #include "otbImage.h"
#include "otbImageFileReader.h" #include "otbImageFileReader.h"
#include "otbImageFileWriter.h" #include "otbImageFileWriter.h"
...@@ -56,8 +49,7 @@ int main(int argc, char* argv[]) ...@@ -56,8 +49,7 @@ int main(int argc, char* argv[])
ReaderType::Pointer reader = ReaderType::New(); ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(argv[1]); reader->SetFileName(argv[1]);
// The \doxygen{itk}{RescaleIntensityImageFilter} is used to rescale the value: // The RescaleIntensityImageFilter is used to rescale the value
typedef itk::RescaleIntensityImageFilter<InputImageType, OutputImageType> RescalerType; typedef itk::RescaleIntensityImageFilter<InputImageType, OutputImageType> RescalerType;
RescalerType::Pointer rescaler = RescalerType::New(); RescalerType::Pointer rescaler = RescalerType::New();
rescaler->SetInput(reader->GetOutput()); rescaler->SetInput(reader->GetOutput());
...@@ -75,20 +67,4 @@ int main(int argc, char* argv[]) ...@@ -75,20 +67,4 @@ int main(int argc, char* argv[])
writer->SetFileName(argv[3]); writer->SetFileName(argv[3]);
writer->SetInput(caster->GetOutput()); writer->SetInput(caster->GetOutput());
writer->Update(); writer->Update();
// Figure~\ref{fig:SCALING_FILTER} illustrates the difference between a proper scaling and
// a simple truncation of the value and demonstrates why it is
// important to keep this in mind.
// \begin{figure}
// \center
// \includegraphics[width=0.44\textwidth]{QB_Toulouse_Ortho_PAN_casted.eps}
// \includegraphics[width=0.44\textwidth]{QB_Toulouse_Ortho_PAN_rescaled.eps}
// \itkcaption[Scaling images]{On the left, the image obtained by truncated pixel values
// at the dynamic acceptable for a png file (between 0 and 255). On the right,
// the same image with
// a proper rescaling}
// \label{fig:SCALING_FILTER}
// \end{figure}
return EXIT_SUCCESS;
} }
On one hand, satellite images are commonly coded on more than 8 bits to provide
the dynamic range required from shadows to clouds. On the other hand, image formats
in use for printing and display are usually limited to 8 bits. We need to convert the value
to enable a proper display. This is usually done using linear scaling. Of course, you have
to be aware that some information is lost in the process.
.. |image1| image:: /Output/QB_Toulouse_Ortho_PAN_casted.png
.. |image2| image:: /Output/QB_Toulouse_Ortho_PAN_rescaled.png
.. _Figure1:
+--------------------------+-------------------------+
| |image1| | |image2| |
+--------------------------+-------------------------+
On the left, the image obtained by truncated pixel values at the dynamic acceptable for a png file (between 0 and 255). On the right, the same image with a proper rescaling.
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