Skip to content
Snippets Groups Projects
Commit 885bc7dc authored by Carole Amiot's avatar Carole Amiot
Browse files

STYLE: Add documentation to private functions

Also add const qualifier to these private functions
parent 8d33208c
No related branches found
No related tags found
No related merge requests found
......@@ -112,6 +112,13 @@ namespace otb{
void GenerateInputRequestedRegion() override;
/** Compute the requested input region, given an output region.
* If the input requested region is outside the largest input region, a mirror padding
* is necessary. The returned tuple is composed of the following paramters :
* * input requested region (always lie inside the largest input region)
* * top rows, left cols, bottom rows, right cols : numbers of rows/cols to add with a mirror padding
* * boolean : if true, a mirror padding (in at least one direction) has to be computed
*/
std::tuple<InRegionType, int, int, int, int, bool> OutputRegionToInputRegion
(const OutRegionType& outputRegion) const;
......@@ -122,16 +129,27 @@ namespace otb{
NLMeansFilter(const Self&) = delete; //purposely not implemented
NLMeansFilter& operator=(const Self&) = delete; //purposely not implemented
/** For a given shift in rows and cols, this function computes
* the squared difference between the image and its shifted version.
* Results are added to form an integral image.
*/
void ComputeIntegralImage(
const std::vector<double> & dataInput,
std::vector<double> &imIntegral,
const OutIndexType shift, const InSizeType sizeIntegral,
const InSizeType sizeInput);
OutPixelType ComputeDistance(const unsigned int row,
const unsigned int col,
const std::vector<double>& imIntegral,
const unsigned int nbCols);
const std::vector<double> & dataInput, /**< input data stored in a vector */
std::vector<double> &imIntegral, /**< output parameter. Contains the integral image of squared difference */
const OutIndexType shift, /**< Shift (dcol, drow) to apply to compute the difference */
const InSizeType sizeIntegral, /**< Integral image size */
const InSizeType sizeInput /**< input data image size */
) const;
/** This function computes the squared euclidean distance
* between a patch and its shifted version.
* Computation relies on the integral image obtained before.
*/
OutPixelType ComputeDistance(const unsigned int row, /**< Upper left corner row coordinate of patch*/
const unsigned int col, /**< Upper left corner col coordinate of patch*/
const std::vector<double>& imIntegral, /**< Integral image of squared difference*/
const unsigned int nbCols /**< Integral image number of columns */
) const;
// Define class attributes
InSizeType m_HalfSearchSize;
......
......@@ -251,7 +251,7 @@ namespace otb
NLMeansFilter<TInputImage, TOutputImage>::ComputeIntegralImage
(const std::vector<double> & dataInput,
std::vector<double> &imIntegral,
const OutIndexType shift, const InSizeType sizeIntegral, const InSizeType sizeInput)
const OutIndexType shift, const InSizeType sizeIntegral, const InSizeType sizeInput) const
{
// dataInput has a margin of m_HalfSearchSize+m_HalfPatchSize to allow
// computation of all shifts (computation of all integral images)
......@@ -307,7 +307,7 @@ namespace otb
typename NLMeansFilter<TInputImage, TOutputImage>::OutPixelType
NLMeansFilter<TInputImage, TOutputImage>::ComputeDistance
(const unsigned int row, const unsigned int col,
const std::vector<double>& imIntegral, const unsigned int nbCols)
const std::vector<double>& imIntegral, const unsigned int nbCols) const
{
// (row, col) is the central position of the local window in the output image
// however, integral image is shifted by (m_HalfPatchSize, m_HalfPatchSize) compared to output image
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment