Commit ecaa6fea authored by Victor Poughon's avatar Victor Poughon
Browse files

DOC: review FrostImageFilter

No related merge requests found
Showing with 42 additions and 65 deletions
+42 -65
Data/Output/GomaSmallFrostFiltered.png

130 Bytes

......@@ -23,34 +23,6 @@
./FrostImageFilter Input/GomaSmall.png Output/GomaSmallFrostFiltered.png 5 0.1
*/
// This example illustrates the use of the \doxygen{otb}{FrostImageFilter}.
// This filter belongs to the family of the edge-preserving smoothing
// filters which are usually used for speckle reduction in radar
// images.
//
// This filter uses a negative exponential convolution kernel.
// The output of the filter for pixel p is:
// $ \hat I_{s}=\sum_{p\in\eta_{p}} m_{p}I_{p} $
//
// where : $ m_{p}=\frac{KC_{s}^{2}\exp(-KC_{s}^{2}d_{s, p})}{\sum_{p\in\eta_{p}} KC_{s}^{2}\exp(-KC_{s}^{2}d_{s, p})} $
// and $ d_{s, p}=\sqrt{(i-i_{p})^2+(j-j_{p})^2} $
//
// \begin{itemize}
// \item $ K $ : the decrease coefficient
// \item $ (i, j)$ : the coordinates of the pixel inside the region
// defined by $ \eta_{s} $
// \item $ (i_{p}, j_{p})$ : the coordinates of the pixels belonging to $ \eta_{p} \subset \eta_{s} $
// \item $ C_{s}$ : the variation coefficient computed over $ \eta_{p}$
// \end{itemize}
//
//
//
// Most of this example is similar to the previous one and only the differences
// will be highlighted.
//
// First, we need to include the header:
#include "otbFrostImageFilter.h"
#include "otbImage.h"
......@@ -68,16 +40,12 @@ int main(int argc, char* argv[])
}
typedef unsigned char PixelType;
typedef otb::Image<PixelType, 2> InputImageType;
typedef otb::Image<PixelType, 2> OutputImageType;
// The filter can be instantiated using the image types defined previously.
// The filter can be instantiated using the image types defined previously.
typedef otb::FrostImageFilter<InputImageType, OutputImageType> FilterType;
typedef otb::ImageFileReader<InputImageType> ReaderType;
typedef otb::ImageFileWriter<OutputImageType> WriterType;
ReaderType::Pointer reader = ReaderType::New();
......@@ -87,22 +55,12 @@ int main(int argc, char* argv[])
writer->SetInput(filter->GetOutput());
reader->SetFileName(argv[1]);
// The image obtained with the reader is passed as input to the
// \doxygen{otb}{FrostImageFilter}.
//
// \index{otb::FrostImageFilter!SetInput()}
// \index{otb::FileImageReader!GetOutput()}
// The image obtained with the reader is passed as input to the FrostImageFilter
filter->SetInput(reader->GetOutput());
// The method \code{SetRadius()} defines the size of the window to
// be used for the computation of the local statistics. The method
// \code{SetDeramp()} sets the $K$ coefficient.
//
// \index{otb::FrostImageFilter!SetRadius()}
// \index{otb::FrostImageFilter!SetDeramp()}
// \index{SetDeramp()!otb::FrostImageFilter}
// The method SetRadius() defines the size of the window to
// be used for the computation of the local statistics. The method
// SetDeramp() sets the K coefficient.
FilterType::SizeType Radius;
Radius[0] = atoi(argv[3]);
Radius[1] = atoi(argv[3]);
......@@ -112,22 +70,4 @@ int main(int argc, char* argv[])
writer->SetFileName(argv[2]);
writer->Update();
// Figure~\ref{fig:FROST_FILTER} shows the result of applying the Frost
// filter to a SAR image.
// \begin{figure}
// \center
// \includegraphics[width=0.44\textwidth]{GomaSmall.eps}
// \includegraphics[width=0.44\textwidth]{GomaSmallFrostFiltered.eps}
// \itkcaption[Frost Filter Application]{Result of applying the
// \doxygen{otb}{FrostImageFilter} to a SAR image.}
// \label{fig:FROST_FILTER}
// \end{figure}
//
// \relatedClasses
// \begin{itemize}
// \item \doxygen{otb}{LeeImageFilter}
// \end{itemize}
return EXIT_SUCCESS;
}
This example illustrates the use of the :doxygen:`FrostImageFilter`.
This filter belongs to the family of the edge-preserving smoothing
filters which are usually used for speckle reduction in radar
images.
This filter uses a negative exponential convolution kernel.
The output of the filter for pixel p is:
.. math::
\hat I_{s}=\sum_{p\in\eta_{p}} m_{p}I_{p}
m_{p}=\frac{KC_{s}^{2}\exp(-KC_{s}^{2}d_{s, p})}{\sum_{p\in\eta_{p}} KC_{s}^{2}\exp(-KC_{s}^{2}d_{s, p})}
d_{s, p}=\sqrt{(i-i_{p})^2+(j-j_{p})^2}
where:
* :math:`K`: the decrease coefficient
* :math:`(i, j)`: the coordinates of the pixel inside the region defined by :math:`\eta_{s}`
* :math:`(i_{p}, j_{p})`: the coordinates of the pixels belonging to :math:`\eta_{p} \subset \eta_{s}`
* :math:`C_{s}`: the variation coefficient computed over :math:`\eta_{p}`
.. |image1| image:: /Input/GomaSmall.png
.. |image2| image:: /Output/GomaSmallFrostFiltered.png
.. _Figure1:
+--------------------------+-------------------------+
| |image1| | |image2| |
+--------------------------+-------------------------+
Result of applying the FrostImageFilter to a SAR image.
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