diff --git a/Data/Output/QB_Toulouse_Ortho_PAN_casted.png b/Data/Output/QB_Toulouse_Ortho_PAN_casted.png new file mode 100644 index 0000000000000000000000000000000000000000..23aee06b351d171c95dd0bf521b046c8ebb3fd63 --- /dev/null +++ b/Data/Output/QB_Toulouse_Ortho_PAN_casted.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca5363df6bf1a9fd48d17b033cd507ece65605bce33a8f3da8e3ba4af5f5e705 +size 182862 diff --git a/Data/Output/QB_Toulouse_Ortho_PAN_rescaled.png b/Data/Output/QB_Toulouse_Ortho_PAN_rescaled.png new file mode 100644 index 0000000000000000000000000000000000000000..6a70131af5f2a3b3e2d3eef3b5fcf88c7fcacec6 --- /dev/null +++ b/Data/Output/QB_Toulouse_Ortho_PAN_rescaled.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e333f7abd77db1ab2158975e767ed1ea94ff547747584be07f54a01eae0bb3fa +size 108051 diff --git a/Examples/BasicFilters/ScalingFilterExample.cxx b/Examples/BasicFilters/ScalingFilterExample.cxx index 174fa6699ca6a13dfd88f1d28c79e03ca960d1b5..feef4ec7231e8f0e1a456196a52b04e59daa7f1e 100644 --- a/Examples/BasicFilters/ScalingFilterExample.cxx +++ b/Examples/BasicFilters/ScalingFilterExample.cxx @@ -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 */ - -// 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 "otbImageFileReader.h" #include "otbImageFileWriter.h" @@ -56,8 +49,7 @@ int main(int argc, char* argv[]) ReaderType::Pointer reader = ReaderType::New(); 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; RescalerType::Pointer rescaler = RescalerType::New(); rescaler->SetInput(reader->GetOutput()); @@ -75,20 +67,4 @@ int main(int argc, char* argv[]) writer->SetFileName(argv[3]); writer->SetInput(caster->GetOutput()); 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; } diff --git a/Examples/BasicFilters/ScalingFilterExample.rst b/Examples/BasicFilters/ScalingFilterExample.rst new file mode 100644 index 0000000000000000000000000000000000000000..a284ff97abf3eef2c906d4040e28990aa48acad1 --- /dev/null +++ b/Examples/BasicFilters/ScalingFilterExample.rst @@ -0,0 +1,17 @@ +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.