From 4aa3c9e1ba5aae30daed081f0120e4a902e55ef1 Mon Sep 17 00:00:00 2001 From: Victor Poughon <victor.poughon@cnes.fr> Date: Wed, 24 Apr 2019 17:17:01 +0200 Subject: [PATCH] DOC: review PrintableImageFilterExample --- Data/Output/PrintableExampleOutput1.jpg | 3 ++ Data/Output/PrintableExampleOutput2.jpg | 3 ++ .../PrintableImageFilterExample.cxx | 45 ++----------------- .../PrintableImageFilterExample.rst | 37 +++++++++++++++ 4 files changed, 46 insertions(+), 42 deletions(-) create mode 100644 Data/Output/PrintableExampleOutput1.jpg create mode 100644 Data/Output/PrintableExampleOutput2.jpg create mode 100644 Examples/BasicFilters/PrintableImageFilterExample.rst diff --git a/Data/Output/PrintableExampleOutput1.jpg b/Data/Output/PrintableExampleOutput1.jpg new file mode 100644 index 0000000000..ab0a5d601d --- /dev/null +++ b/Data/Output/PrintableExampleOutput1.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:895c3c368f3daf3049ec2be7164e94f1e0fd3cdd52259bf99fb3b187fece5b3b +size 108726 diff --git a/Data/Output/PrintableExampleOutput2.jpg b/Data/Output/PrintableExampleOutput2.jpg new file mode 100644 index 0000000000..5254ab0bb4 --- /dev/null +++ b/Data/Output/PrintableExampleOutput2.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:57a2949eb07c569b5d0b474d2b9cf8e3f8de62260850dfc1a9b3614c57cdf5bb +size 116071 diff --git a/Examples/BasicFilters/PrintableImageFilterExample.cxx b/Examples/BasicFilters/PrintableImageFilterExample.cxx index abe40efdbb..f632da523c 100644 --- a/Examples/BasicFilters/PrintableImageFilterExample.cxx +++ b/Examples/BasicFilters/PrintableImageFilterExample.cxx @@ -29,30 +29,6 @@ */ -// Most of the time, satellite images have more than three spectral bands. As we -// are only able to see three colors (red, green and blue), we have to find a way to -// represent these images using only three bands. This is called creating a color -// composition. -// -// Of course, any color composition will not be able to render all the information -// available in the original image. As a consequence, sometimes, creating more than -// one color composition will be necessary. -// -// If you want to obtain an image with natural colors, you have to match the wavelength -// captured by the satellite with those captured by your eye: thus matching the red band -// with the red color, etc. -// -// Some satellites (SPOT 5 is an example) do not acquire all the {\em human} spectral bands: -// the blue can be missing and replaced by some other wavelength of interest for a specific application. -// In these situations, another mapping has to be created. That's why, the vegetation often appears in -// red in satellite images (see on left of figure~\ref{fig:PRINTABLE_FILTER}). -// -// The band order in the image products can be also quite tricky. It could be in the wavelength order, -// as it is the case for Quickbird (1: Blue, 2: Green, 3: Red, 4: NIR), in this case, you -// have to be careful to reverse the order if you want a natural display. It could also be reverse -// to facilitate direct viewing, as for SPOT5 (1: NIR, 2: Red, 3: Green, 4: SWIR) but in this situations -// you have to be careful when you process the image. - #include "otbVectorImage.h" #include "otbImageFileReader.h" #include "otbImageFileWriter.h" @@ -84,9 +60,8 @@ int main(int argc, char* argv[]) ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(inputFilename); - // To easily convert the image to a {\em printable} format, i.e. 3 bands - // \code{unsigned char} value, you can use the \doxygen{otb}{PrintableImageFilter}. - + // To easily convert the image to a printable format, i.e. 3 bands + // unsigned char value, you can use the PrintableImageFilter. typedef otb::PrintableImageFilter<InputImageType> PrintableFilterType; PrintableFilterType::Pointer printableImageFilter = PrintableFilterType::New(); @@ -95,9 +70,8 @@ int main(int argc, char* argv[]) printableImageFilter->SetChannel(greenChannelNumber); printableImageFilter->SetChannel(blueChannelNumber); - // When you create the writer to plug at the output of the \code{printableImageFilter} + // When you create the writer to plug at the output of the printableImageFilter // you may want to use the direct type definition as it is a good way to avoid mismatch: - typedef PrintableFilterType::OutputImageType OutputImageType; typedef otb::ImageFileWriter<OutputImageType> WriterType; @@ -106,17 +80,4 @@ int main(int argc, char* argv[]) writer->SetInput(printableImageFilter->GetOutput()); writer->Update(); - - // Figure~\ref{fig:PRINTABLE_FILTER} illustrates different color compositions for a SPOT 5 image. - // \begin{figure} - // \center - // \includegraphics[width=0.44\textwidth]{PrintableExampleOutput1.eps} - // \includegraphics[width=0.44\textwidth]{PrintableExampleOutput2.eps} - // \itkcaption[Scaling images]{On the left, a classic SPOT5 - // combination: XS3 in red, XS2 in green and XS1 in blue. On the - // right another composition: XS3 in red, XS4 in green and XS2 in blue.} - // \label{fig:PRINTABLE_FILTER} - // \end{figure} - - return EXIT_SUCCESS; } diff --git a/Examples/BasicFilters/PrintableImageFilterExample.rst b/Examples/BasicFilters/PrintableImageFilterExample.rst new file mode 100644 index 0000000000..532a2f51f1 --- /dev/null +++ b/Examples/BasicFilters/PrintableImageFilterExample.rst @@ -0,0 +1,37 @@ +Most of the time, satellite images have more than three spectral bands. As we +are only able to see three colors (red, green and blue), we have to find a way +to represent these images using only three bands. This is called creating a +color composition. + +Of course, any color composition will not be able to render all the information +available in the original image. As a consequence, sometimes, creating more than +one color composition will be necessary. + +If you want to obtain an image with natural colors, you have to match the +wavelength captured by the satellite with those captured by your eye: thus +matching the red band with the red color, etc. + +Some satellites (SPOT 5 is an example) do not acquire all the visible +spectral bands: the blue can be missing and replaced by some other wavelength of +interest for a specific application. In these situations, another mapping has +to be created. That's why, the vegetation often appears in red in satellite +images. + +The band order in the image products can be also quite tricky. It could be in +the wavelength order, as it is the case for Quickbird (1: Blue, 2: Green, 3: +Red, 4: NIR), in this case, you have to be careful to reverse the order if you +want a natural display. It could also be reverse to facilitate direct viewing, +as for SPOT5 (1: NIR, 2: Red, 3: Green, 4: SWIR) but in this situations you have +to be careful when you process the image. + +.. |image1| image:: /Output/PrintableExampleOutput1.jpg + +.. |image2| image:: /Output/PrintableExampleOutput2.jpg + +.. _Figure1: + ++--------------------------+-------------------------+ +| |image1| | |image2| | ++--------------------------+-------------------------+ + +On the left, a classic SPOT5 combination: XS3 in red, XS2 in green and XS1 in blue. On the right another composition: XS3 in red, XS4 in green and XS2 in blue. -- GitLab