Visual Servoing Platform  version 3.6.0 under development (2023-09-29)
vpImageFilter Class Reference

#include <visp3/core/vpImageFilter.h>

Static Public Member Functions

static void canny (const vpImage< unsigned char > &I, vpImage< unsigned char > &Ic, unsigned int gaussianFilterSize, float thresholdCanny, unsigned int apertureSobel)
 
static void canny (const vpImage< unsigned char > &I, vpImage< unsigned char > &Ic, unsigned int gaussianFilterSize, float lowerThresholdCanny, float higherThresholdCanny, unsigned int apertureSobel)
 
template<class T >
static double derivativeFilterX (const vpImage< T > &I, unsigned int r, unsigned int c)
 
template<class T >
static double derivativeFilterY (const vpImage< T > &I, unsigned int r, unsigned int c)
 
template<class T , typename FilterType >
static FilterType derivativeFilterX (const vpImage< T > &I, unsigned int r, unsigned int c, const FilterType *filter, unsigned int size)
 
template<class T , typename FilterType >
static FilterType derivativeFilterY (const vpImage< T > &I, unsigned int r, unsigned int c, const FilterType *filter, unsigned int size)
 
template<typename FilterType >
static void filter (const vpImage< unsigned char > &I, vpImage< FilterType > &If, const vpArray2D< FilterType > &M, bool convolve=false)
 
template<typename FilterType >
static void filter (const vpImage< FilterType > &I, vpImage< FilterType > &Iu, vpImage< FilterType > &Iv, const vpArray2D< FilterType > &M, bool convolve=false)
 
static void sepFilter (const vpImage< unsigned char > &I, vpImage< double > &If, const vpColVector &kernelH, const vpColVector &kernelV)
 
template<typename FilterType >
static void filter (const vpImage< unsigned char > &I, vpImage< FilterType > &GI, const FilterType *filter, unsigned int size)
 
template<typename FilterType >
static void filter (const vpImage< FilterType > &I, vpImage< FilterType > &GI, const FilterType *filter, unsigned int size)
 
static unsigned char filterGaussXPyramidal (const vpImage< unsigned char > &I, unsigned int i, unsigned int j)
 
static unsigned char filterGaussYPyramidal (const vpImage< unsigned char > &I, unsigned int i, unsigned int j)
 
template<typename FilterType >
static void filterX (const vpImage< unsigned char > &I, vpImage< FilterType > &dIx, const FilterType *filter, unsigned int size)
 
template<typename FilterType >
static void filterX (const vpImage< FilterType > &I, vpImage< FilterType > &dIx, const FilterType *filter, unsigned int size)
 
static void filterX (const vpImage< vpRGBa > &I, vpImage< vpRGBa > &dIx, const double *filter, unsigned int size)
 
static void filterXR (const vpImage< vpRGBa > &I, vpImage< vpRGBa > &dIx, const double *filter, unsigned int size)
 
static void filterXG (const vpImage< vpRGBa > &I, vpImage< vpRGBa > &dIx, const double *filter, unsigned int size)
 
static void filterXB (const vpImage< vpRGBa > &I, vpImage< vpRGBa > &dIx, const double *filter, unsigned int size)
 
template<typename FilterType >
static FilterType filterX (const vpImage< unsigned char > &I, unsigned int r, unsigned int c, const FilterType *filter, unsigned int size)
 
static double filterXR (const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
 
static double filterXG (const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
 
static double filterXB (const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
 
template<typename FilterType >
static FilterType filterXLeftBorder (const vpImage< unsigned char > &I, unsigned int r, unsigned int c, const FilterType *filter, unsigned int size)
 
static double filterXLeftBorderR (const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
 
static double filterXLeftBorderG (const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
 
static double filterXLeftBorderB (const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
 
template<typename FilterType >
static FilterType filterXRightBorder (const vpImage< unsigned char > &I, unsigned int r, unsigned int c, const FilterType *filter, unsigned int size)
 
static double filterXRightBorderR (const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
 
static double filterXRightBorderG (const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
 
static double filterXRightBorderB (const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
 
template<typename FilterType >
static FilterType filterX (const vpImage< FilterType > &I, unsigned int r, unsigned int c, const FilterType *filter, unsigned int size)
 
template<typename FilterType >
static FilterType filterXLeftBorder (const vpImage< FilterType > &I, unsigned int r, unsigned int c, const FilterType *filter, unsigned int size)
 
template<typename FilterType >
static FilterType filterXRightBorder (const vpImage< FilterType > &I, unsigned int r, unsigned int c, const FilterType *filter, unsigned int size)
 
template<typename FilterType >
static void filterY (const vpImage< unsigned char > &I, vpImage< FilterType > &dIy, const FilterType *filter, unsigned int size)
 
static void filterY (const vpImage< vpRGBa > &I, vpImage< vpRGBa > &dIx, const double *filter, unsigned int size)
 
static void filterYR (const vpImage< vpRGBa > &I, vpImage< vpRGBa > &dIx, const double *filter, unsigned int size)
 
static void filterYG (const vpImage< vpRGBa > &I, vpImage< vpRGBa > &dIx, const double *filter, unsigned int size)
 
static void filterYB (const vpImage< vpRGBa > &I, vpImage< vpRGBa > &dIx, const double *filter, unsigned int size)
 
template<typename FilterType >
static void filterY (const vpImage< FilterType > &I, vpImage< FilterType > &dIy, const FilterType *filter, unsigned int size)
 
template<typename FilterType >
static FilterType filterY (const vpImage< unsigned char > &I, unsigned int r, unsigned int c, const FilterType *filter, unsigned int size)
 
static double filterYR (const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
 
static double filterYG (const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
 
static double filterYB (const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
 
template<typename FilterType >
static FilterType filterYTopBorder (const vpImage< unsigned char > &I, unsigned int r, unsigned int c, const FilterType *filter, unsigned int size)
 
static double filterYTopBorderR (const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
 
static double filterYTopBorderG (const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
 
static double filterYTopBorderB (const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
 
template<typename FilterType >
static FilterType filterYBottomBorder (const vpImage< unsigned char > &I, unsigned int r, unsigned int c, const FilterType *filter, unsigned int size)
 
static double filterYBottomBorderR (const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
 
static double filterYBottomBorderG (const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
 
static double filterYBottomBorderB (const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
 
template<typename FilterType >
static FilterType filterYTopBorder (const vpImage< double > &I, unsigned int r, unsigned int c, const FilterType *filter, unsigned int size)
 
template<typename FilterType >
static FilterType filterYBottomBorder (const vpImage< double > &I, unsigned int r, unsigned int c, const FilterType *filter, unsigned int size)
 
template<typename FilterType >
static FilterType filterY (const vpImage< double > &I, unsigned int r, unsigned int c, const FilterType *filter, unsigned int size)
 
template<typename FilterType >
static void gaussianBlur (const vpImage< unsigned char > &I, vpImage< FilterType > &GI, unsigned int size=7, FilterType sigma=0., bool normalize=true)
 
static void gaussianBlur (const vpImage< vpRGBa > &I, vpImage< vpRGBa > &GI, unsigned int size=7, double sigma=0., bool normalize=true)
 
template<typename FilterType >
static void gaussianBlur (const vpImage< FilterType > &I, vpImage< FilterType > &GI, unsigned int size=7, FilterType sigma=0., bool normalize=true)
 
template<class T >
static double gaussianFilter (const vpImage< T > &fr, unsigned int r, unsigned int c)
 
static void getGaussPyramidal (const vpImage< unsigned char > &I, vpImage< unsigned char > &GI)
 
static void getGaussXPyramidal (const vpImage< unsigned char > &I, vpImage< unsigned char > &GI)
 
static void getGaussYPyramidal (const vpImage< unsigned char > &I, vpImage< unsigned char > &GI)
 
template<typename FilterType >
static void getGaussianKernel (FilterType *filter, unsigned int size, FilterType sigma=0., bool normalize=true)
 
template<typename FilterType >
static void getGaussianDerivativeKernel (FilterType *filter, unsigned int size, FilterType sigma=0., bool normalize=true)
 
template<typename FilterType >
static void getGradX (const vpImage< unsigned char > &I, vpImage< FilterType > &dIx)
 
template<typename ImageType , typename FilterType >
static void getGradX (const vpImage< ImageType > &I, vpImage< FilterType > &dIx, const FilterType *filter, unsigned int size)
 
template<typename ImageType , typename FilterType >
static void getGradXGauss2D (const vpImage< ImageType > &I, vpImage< FilterType > &dIx, const FilterType *gaussianKernel, const FilterType *gaussianDerivativeKernel, unsigned int size)
 
template<typename FilterType >
static void getGradY (const vpImage< unsigned char > &I, vpImage< FilterType > &dIy)
 
template<typename ImageType , typename FilterType >
static void getGradY (const vpImage< ImageType > &I, vpImage< FilterType > &dIy, const FilterType *filter, unsigned int size)
 
template<typename ImageType , typename FilterType >
static void getGradYGauss2D (const vpImage< ImageType > &I, vpImage< FilterType > &dIy, const FilterType *gaussianKernel, const FilterType *gaussianDerivativeKernel, unsigned int size)
 
template<typename FilterType >
static FilterType getSobelKernelX (FilterType *filter, unsigned int size)
 
template<typename FilterType >
static FilterType getSobelKernelY (FilterType *filter, unsigned int size)
 
static float computeCannyThreshold (const cv::Mat &cv_I, const cv::Mat *p_cv_blur, float &lowerThresh)
 
static float computeCannyThreshold (const vpImage< unsigned char > &I, float &lowerThresh)
 
static float median (const cv::Mat &cv_I)
 
static float median (const vpImage< unsigned char > &Isrc)
 
static std::vector< float > median (const vpImage< vpRGBa > &Isrc)
 

Detailed Description

Various image filter, convolution, etc...

Definition at line 67 of file vpImageFilter.h.

Member Function Documentation

◆ canny() [1/2]

void vpImageFilter::canny ( const vpImage< unsigned char > &  Isrc,
vpImage< unsigned char > &  Ires,
unsigned int  gaussianFilterSize,
float  lowerThreshold,
float  upperThreshold,
unsigned int  apertureSobel 
)
static

Apply the Canny edge operator on the image Isrc and return the resulting image Ires.

The following example shows how to use the method:

#include <visp3/core/vpImage.h>
#include <visp3/core/vpImageFilter.h>
int main()
{
// Constants for the Canny operator.
const unsigned int gaussianFilterSize = 5;
const float upperThresholdCanny = 15;
const float lowerThresholdCanny = 5;
const unsigned int apertureSobel = 3;
// Image for the Canny edge operator
// First grab the source image Isrc.
// Apply the Canny edge operator and set the Icanny image.
vpImageFilter::canny(Isrc, Icanny, gaussianFilterSize, lowerThresholdCanny, upperThresholdCanny, apertureSobel);
return (0);
}
static void canny(const vpImage< unsigned char > &I, vpImage< unsigned char > &Ic, unsigned int gaussianFilterSize, float thresholdCanny, unsigned int apertureSobel)
Parameters
Isrc: Image to apply the Canny edge detector to.
Ires: Filtered image (255 means an edge, 0 otherwise).
gaussianFilterSize: The size of the mask of the Gaussian filter to apply (an odd number).
lowerThreshold: The lower threshold for the Canny operator. Values lower than this value are rejected. If negative, it will be set to one third of the thresholdCanny .
upperThreshold: The upper threshold for the Canny operator. Only value greater than this value are marked as an edge. If negative, it will be automatically computed, along with the lower threshold. Otherwise, the lower threshold will be set to one third of the thresholdCanny .
apertureSobel: Size of the mask for the Sobel operator (odd number).

Definition at line 347 of file vpImageFilter.cpp.

References vpException::badValue, computeCannyThreshold(), vpImageConvert::convert(), and vpCannyEdgeDetection::detect().

◆ canny() [2/2]

void vpImageFilter::canny ( const vpImage< unsigned char > &  Isrc,
vpImage< unsigned char > &  Ires,
unsigned int  gaussianFilterSize,
float  thresholdCanny,
unsigned int  apertureSobel 
)
static

Apply the Canny edge operator on the image Isrc and return the resulting image Ires.

The following example shows how to use the method:

#include <visp3/core/vpImage.h>
#include <visp3/core/vpImageFilter.h>
int main()
{
// Constants for the Canny operator.
const unsigned int gaussianFilterSize = 5;
const double thresholdCanny = 15;
const unsigned int apertureSobel = 3;
// Image for the Canny edge operator
// First grab the source image Isrc.
// Apply the Canny edge operator and set the Icanny image.
vpImageFilter::canny(Isrc, Icanny, gaussianFilterSize, thresholdCanny, apertureSobel);
return (0);
}
Parameters
Isrc: Image to apply the Canny edge detector to.
Ires: Filtered image (255 means an edge, 0 otherwise).
gaussianFilterSize: The size of the mask of the Gaussian filter to apply (an odd number).
thresholdCanny: The upper threshold for the Canny operator. Only value greater than this value are marked as an edge. If negative, it will be automatically computed, along with the lower threshold. Otherwise, the lower threshold will be set to one third of the thresholdCanny .
apertureSobel: Size of the mask for the Sobel operator (odd number).
Examples
tutorial-image-filter.cpp.

Definition at line 298 of file vpImageFilter.cpp.

Referenced by vpMeNurbs::seekExtremitiesCanny().

◆ computeCannyThreshold() [1/2]

float vpImageFilter::computeCannyThreshold ( const cv::Mat &  cv_I,
const cv::Mat *  p_cv_blur,
float &  lowerThresh 
)
static

Compute the upper Canny edge filter threshold.

Parameters
[in]cv_I: The image, in cv format.
[in]p_cv_blur: If different from nullptr, must contain a blurred version of cv_I.
[out]lowerThresh: The lower threshold for the Canny edge filter.
Returns
The upper Canny edge filter threshold.

Definition at line 219 of file vpImageFilter.cpp.

References median().

Referenced by canny(), and computeCannyThreshold().

◆ computeCannyThreshold() [2/2]

float vpImageFilter::computeCannyThreshold ( const vpImage< unsigned char > &  I,
float &  lowerThresh 
)
static

Compute the upper Canny edge filter threshold.

Parameters
[in]I: The gray-scale image, in ViSP format.
[in]lowerThresh: Canny lower threshold.
Returns
The upper Canny edge filter threshold.

Definition at line 251 of file vpImageFilter.cpp.

References computeCannyThreshold(), and vpImageConvert::convert().

◆ derivativeFilterX() [1/2]

template<class T >
static double vpImageFilter::derivativeFilterX ( const vpImage< T > &  I,
unsigned int  r,
unsigned int  c 
)
inlinestatic

Apply a 1x3 derivative filter to an image pixel.

Parameters
I: Image to filter
r: coordinates (row) of the pixel
c: coordinates (column) of the pixel

Definition at line 83 of file vpImageFilter.h.

Referenced by vpFeatureLuminance::buildFrom(), and getGradX().

◆ derivativeFilterX() [2/2]

template<class T , typename FilterType >
static FilterType vpImageFilter::derivativeFilterX ( const vpImage< T > &  I,
unsigned int  r,
unsigned int  c,
const FilterType *  filter,
unsigned int  size 
)
inlinestatic

Apply a 1 x size Derivative Filter in X to an image pixel.

Template Parameters
FilterType: Either float, to accelerate the computation time, or double, to have greater precision.
Parameters
I: Image to filter
r: Coordinates(row) of the pixel
c: Coordinates(column) of the pixel
filter: Coefficients of the filter to be initialized using vpImageFilter::getGaussianDerivativeKernel().
size: Size of the filter.
See also
vpImageFilter::getGaussianDerivativeKernel()

Definition at line 116 of file vpImageFilter.h.

◆ derivativeFilterY() [1/2]

template<class T >
static double vpImageFilter::derivativeFilterY ( const vpImage< T > &  I,
unsigned int  r,
unsigned int  c 
)
inlinestatic

Apply a 3x1 derivative filter to an image pixel.

Parameters
I: Image to filter
r: coordinates (row) of the pixel
c: coordinates (column) of the pixel

Definition at line 96 of file vpImageFilter.h.

Referenced by vpFeatureLuminance::buildFrom(), and getGradY().

◆ derivativeFilterY() [2/2]

template<class T , typename FilterType >
static FilterType vpImageFilter::derivativeFilterY ( const vpImage< T > &  I,
unsigned int  r,
unsigned int  c,
const FilterType *  filter,
unsigned int  size 
)
inlinestatic

Apply a size x 1 Derivative Filter in Y to an image pixel.

Template Parameters
FilterType: Either float, to accelerate the computation time, or double, to have greater precision.
Parameters
I: Image to filter.
r: Coordinates (row) of the pixel.
c: Coordinates (column) of the pixel.
filter: Coefficients of the filter to be initialized using vpImageFilter::getGaussianDerivativeKernel().
size: Size of the filter.
See also
vpImageFilter::getGaussianDerivativeKernel()

Definition at line 143 of file vpImageFilter.h.

◆ filter() [1/4]

template<typename FilterType >
static void vpImageFilter::filter ( const vpImage< FilterType > &  I,
vpImage< FilterType > &  GI,
const FilterType *  filter,
unsigned int  size 
)
inlinestatic

Apply a separable filter.

Template Parameters
FilterType: Either float, to accelerate the computation time, or double, to have greater precision.
Parameters
IThe original image.
GIThe filtered image.
filterThe separable filter.
sizeThe size of the filter.

Definition at line 312 of file vpImageFilter.h.

References vpImage< Type >::destroy().

◆ filter() [2/4]

template<typename FilterType >
static void vpImageFilter::filter ( const vpImage< FilterType > &  I,
vpImage< FilterType > &  Iu,
vpImage< FilterType > &  Iv,
const vpArray2D< FilterType > &  M,
bool  convolve = false 
)
inlinestatic

Apply a filter to an image:

\[ \textbf{I}_u = \textbf{M} \ast \textbf{I} \textbf{ and } \textbf{I}_v = \textbf{M}^t \ast \textbf{I} \]

Template Parameters
FilterType: Either float, to accelerate the computation time, or double, to have greater precision.
Parameters
I: Image to filter
Iu: Filtered image along the horizontal axis (u = columns).
Iv: Filtered image along the vertical axis (v = rows).
M: Filter kernel.
convolve: If true, perform a convolution otherwise a correlation.

Definition at line 237 of file vpImageFilter.h.

References vpImage< Type >::getHeight(), vpArray2D< Type >::getRows(), vpImage< Type >::getWidth(), and vpImage< Type >::resize().

◆ filter() [3/4]

template<typename FilterType >
static void vpImageFilter::filter ( const vpImage< unsigned char > &  I,
vpImage< FilterType > &  GI,
const FilterType *  filter,
unsigned int  size 
)
inlinestatic

Apply a separable filter.

Template Parameters
FilterType: Either float, to accelerate the computation time, or double, to have greater precision.
Parameters
I: The original image.
GI: The filtered image.
filter: The separable filter.
size: The size of the filter.

Definition at line 295 of file vpImageFilter.h.

References vpImage< Type >::destroy().

◆ filter() [4/4]

template<typename FilterType >
static void vpImageFilter::filter ( const vpImage< unsigned char > &  I,
vpImage< FilterType > &  If,
const vpArray2D< FilterType > &  M,
bool  convolve = false 
)
inlinestatic

Apply a filter to an image.

Template Parameters
FilterType: Either float, to accelerate the computation time, or double, to have greater precision.
Parameters
I: Image to filter
If: Filtered image.
M: Filter kernel.
convolve: If true, perform a convolution otherwise a correlation.
Note
By default it performs a correlation:

\[ \textbf{I\_filtered} \left( u,v \right) = \sum_{y=0}^{\textbf{kernel\_h}} \sum_{x=0}^{\textbf{kernel\_w}} \textbf{M} \left( x,y \right ) \times \textbf{I} \left( u-\frac{\textbf{kernel\_w}}{2}+x,v-\frac{\textbf{kernel\_h}}{2}+y \right) \]

The convolution is almost the same operation:

\[ \textbf{I\_filtered} \left( u,v \right) = \sum_{y=0}^{\textbf{kernel\_h}} \sum_{x=0}^{\textbf{kernel\_w}} \textbf{M} \left( x,y \right ) \times \textbf{I} \left( u+\frac{\textbf{kernel\_w}}{2}-x,v+\frac{\textbf{kernel\_h}}{2}-y \right) \]

Only pixels in the input image fully covered by the kernel are considered.
Examples
testImageFilter.cpp, and tutorial-image-filter.cpp.

Definition at line 185 of file vpImageFilter.h.

References vpArray2D< Type >::getCols(), vpImage< Type >::getHeight(), vpArray2D< Type >::getRows(), vpImage< Type >::getWidth(), and vpImage< Type >::resize().

Referenced by filterX(), filterY(), vpTemplateTracker::getGaussianBluredImage(), vpTemplateTrackerMI::getMI(), vpTemplateTrackerMI::getMI256(), vpTemplateTrackerZNCCForwardAdditional::initHessienDesired(), vpTemplateTrackerZNCCInverseCompositional::initHessienDesired(), vpTemplateTrackerMIESM::initHessienDesired(), vpTemplateTrackerMIForwardAdditional::initHessienDesired(), vpTemplateTrackerMIForwardCompositional::initHessienDesired(), vpTemplateTrackerMIInverseCompositional::initHessienDesired(), vpTemplateTracker::initTracking(), vpTemplateTrackerSSDESM::trackNoPyr(), vpTemplateTrackerSSDForwardAdditional::trackNoPyr(), vpTemplateTrackerSSDForwardCompositional::trackNoPyr(), vpTemplateTrackerSSDInverseCompositional::trackNoPyr(), vpTemplateTrackerZNCCForwardAdditional::trackNoPyr(), vpTemplateTrackerZNCCInverseCompositional::trackNoPyr(), vpTemplateTrackerMIESM::trackNoPyr(), vpTemplateTrackerMIForwardAdditional::trackNoPyr(), vpTemplateTrackerMIForwardCompositional::trackNoPyr(), and vpTemplateTrackerMIInverseCompositional::trackNoPyr().

◆ filterGaussXPyramidal()

static unsigned char vpImageFilter::filterGaussXPyramidal ( const vpImage< unsigned char > &  I,
unsigned int  i,
unsigned int  j 
)
inlinestatic

Definition at line 320 of file vpImageFilter.h.

Referenced by getGaussXPyramidal().

◆ filterGaussYPyramidal()

static unsigned char vpImageFilter::filterGaussYPyramidal ( const vpImage< unsigned char > &  I,
unsigned int  i,
unsigned int  j 
)
inlinestatic

Definition at line 324 of file vpImageFilter.h.

Referenced by getGaussYPyramidal().

◆ filterX() [1/5]

template<typename FilterType >
static FilterType vpImageFilter::filterX ( const vpImage< FilterType > &  I,
unsigned int  r,
unsigned int  c,
const FilterType *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 548 of file vpImageFilter.h.

◆ filterX() [2/5]

template<typename FilterType >
static void vpImageFilter::filterX ( const vpImage< FilterType > &  I,
vpImage< FilterType > &  dIx,
const FilterType *  filter,
unsigned int  size 
)
inlinestatic

◆ filterX() [3/5]

template<typename FilterType >
static FilterType vpImageFilter::filterX ( const vpImage< unsigned char > &  I,
unsigned int  r,
unsigned int  c,
const FilterType *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 369 of file vpImageFilter.h.

◆ filterX() [4/5]

template<typename FilterType >
static void vpImageFilter::filterX ( const vpImage< unsigned char > &  I,
vpImage< FilterType > &  dIx,
const FilterType *  filter,
unsigned int  size 
)
inlinestatic

◆ filterX() [5/5]

◆ filterXB() [1/2]

static double vpImageFilter::filterXB ( const vpImage< vpRGBa > &  I,
unsigned int  r,
unsigned int  c,
const double *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 405 of file vpImageFilter.h.

◆ filterXB() [2/2]

static void vpImageFilter::filterXB ( const vpImage< vpRGBa > &  I,
vpImage< vpRGBa > &  dIx,
const double *  filter,
unsigned int  size 
)
static

Referenced by filterX().

◆ filterXG() [1/2]

static double vpImageFilter::filterXG ( const vpImage< vpRGBa > &  I,
unsigned int  r,
unsigned int  c,
const double *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 393 of file vpImageFilter.h.

◆ filterXG() [2/2]

static void vpImageFilter::filterXG ( const vpImage< vpRGBa > &  I,
vpImage< vpRGBa > &  dIx,
const double *  filter,
unsigned int  size 
)
static

Referenced by filterX().

◆ filterXLeftBorder() [1/2]

template<typename FilterType >
static FilterType vpImageFilter::filterXLeftBorder ( const vpImage< FilterType > &  I,
unsigned int  r,
unsigned int  c,
const FilterType *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 562 of file vpImageFilter.h.

◆ filterXLeftBorder() [2/2]

template<typename FilterType >
static FilterType vpImageFilter::filterXLeftBorder ( const vpImage< unsigned char > &  I,
unsigned int  r,
unsigned int  c,
const FilterType *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 418 of file vpImageFilter.h.

◆ filterXLeftBorderB()

static double vpImageFilter::filterXLeftBorderB ( const vpImage< vpRGBa > &  I,
unsigned int  r,
unsigned int  c,
const double *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 466 of file vpImageFilter.h.

Referenced by filterX().

◆ filterXLeftBorderG()

static double vpImageFilter::filterXLeftBorderG ( const vpImage< vpRGBa > &  I,
unsigned int  r,
unsigned int  c,
const double *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 450 of file vpImageFilter.h.

Referenced by filterX().

◆ filterXLeftBorderR()

static double vpImageFilter::filterXLeftBorderR ( const vpImage< vpRGBa > &  I,
unsigned int  r,
unsigned int  c,
const double *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 434 of file vpImageFilter.h.

Referenced by filterX().

◆ filterXR() [1/2]

static double vpImageFilter::filterXR ( const vpImage< vpRGBa > &  I,
unsigned int  r,
unsigned int  c,
const double *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 381 of file vpImageFilter.h.

◆ filterXR() [2/2]

static void vpImageFilter::filterXR ( const vpImage< vpRGBa > &  I,
vpImage< vpRGBa > &  dIx,
const double *  filter,
unsigned int  size 
)
static

Referenced by filterX().

◆ filterXRightBorder() [1/2]

template<typename FilterType >
static FilterType vpImageFilter::filterXRightBorder ( const vpImage< FilterType > &  I,
unsigned int  r,
unsigned int  c,
const FilterType *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 579 of file vpImageFilter.h.

References vpImage< Type >::getWidth().

◆ filterXRightBorder() [2/2]

template<typename FilterType >
static FilterType vpImageFilter::filterXRightBorder ( const vpImage< unsigned char > &  I,
unsigned int  r,
unsigned int  c,
const FilterType *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 483 of file vpImageFilter.h.

References vpImage< Type >::getWidth().

◆ filterXRightBorderB()

static double vpImageFilter::filterXRightBorderB ( const vpImage< vpRGBa > &  I,
unsigned int  r,
unsigned int  c,
const double *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 531 of file vpImageFilter.h.

References vpImage< Type >::getWidth().

Referenced by filterX().

◆ filterXRightBorderG()

static double vpImageFilter::filterXRightBorderG ( const vpImage< vpRGBa > &  I,
unsigned int  r,
unsigned int  c,
const double *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 515 of file vpImageFilter.h.

References vpImage< Type >::getWidth().

Referenced by filterX().

◆ filterXRightBorderR()

static double vpImageFilter::filterXRightBorderR ( const vpImage< vpRGBa > &  I,
unsigned int  r,
unsigned int  c,
const double *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 499 of file vpImageFilter.h.

References vpImage< Type >::getWidth().

Referenced by filterX().

◆ filterY() [1/5]

template<typename FilterType >
static FilterType vpImageFilter::filterY ( const vpImage< double > &  I,
unsigned int  r,
unsigned int  c,
const FilterType *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 852 of file vpImageFilter.h.

◆ filterY() [2/5]

template<typename FilterType >
static void vpImageFilter::filterY ( const vpImage< FilterType > &  I,
vpImage< FilterType > &  dIy,
const FilterType *  filter,
unsigned int  size 
)
inlinestatic

◆ filterY() [3/5]

template<typename FilterType >
static FilterType vpImageFilter::filterY ( const vpImage< unsigned char > &  I,
unsigned int  r,
unsigned int  c,
const FilterType *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 643 of file vpImageFilter.h.

◆ filterY() [4/5]

template<typename FilterType >
static void vpImageFilter::filterY ( const vpImage< unsigned char > &  I,
vpImage< FilterType > &  dIy,
const FilterType *  filter,
unsigned int  size 
)
inlinestatic

◆ filterY() [5/5]

◆ filterYB() [1/2]

static double vpImageFilter::filterYB ( const vpImage< vpRGBa > &  I,
unsigned int  r,
unsigned int  c,
const double *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 678 of file vpImageFilter.h.

◆ filterYB() [2/2]

static void vpImageFilter::filterYB ( const vpImage< vpRGBa > &  I,
vpImage< vpRGBa > &  dIx,
const double *  filter,
unsigned int  size 
)
static

Referenced by filterY().

◆ filterYBottomBorder() [1/2]

template<typename FilterType >
static FilterType vpImageFilter::filterYBottomBorder ( const vpImage< double > &  I,
unsigned int  r,
unsigned int  c,
const FilterType *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 835 of file vpImageFilter.h.

References vpImage< Type >::getHeight().

◆ filterYBottomBorder() [2/2]

template<typename FilterType >
static FilterType vpImageFilter::filterYBottomBorder ( const vpImage< unsigned char > &  I,
unsigned int  r,
unsigned int  c,
const FilterType *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 753 of file vpImageFilter.h.

References vpImage< Type >::getHeight().

◆ filterYBottomBorderB()

static double vpImageFilter::filterYBottomBorderB ( const vpImage< vpRGBa > &  I,
unsigned int  r,
unsigned int  c,
const double *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 801 of file vpImageFilter.h.

References vpImage< Type >::getHeight().

Referenced by filterY().

◆ filterYBottomBorderG()

static double vpImageFilter::filterYBottomBorderG ( const vpImage< vpRGBa > &  I,
unsigned int  r,
unsigned int  c,
const double *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 785 of file vpImageFilter.h.

References vpImage< Type >::getHeight().

Referenced by filterY().

◆ filterYBottomBorderR()

static double vpImageFilter::filterYBottomBorderR ( const vpImage< vpRGBa > &  I,
unsigned int  r,
unsigned int  c,
const double *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 769 of file vpImageFilter.h.

References vpImage< Type >::getHeight().

Referenced by filterY().

◆ filterYG() [1/2]

static double vpImageFilter::filterYG ( const vpImage< vpRGBa > &  I,
unsigned int  r,
unsigned int  c,
const double *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 666 of file vpImageFilter.h.

◆ filterYG() [2/2]

static void vpImageFilter::filterYG ( const vpImage< vpRGBa > &  I,
vpImage< vpRGBa > &  dIx,
const double *  filter,
unsigned int  size 
)
static

Referenced by filterY().

◆ filterYR() [1/2]

static double vpImageFilter::filterYR ( const vpImage< vpRGBa > &  I,
unsigned int  r,
unsigned int  c,
const double *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 655 of file vpImageFilter.h.

◆ filterYR() [2/2]

static void vpImageFilter::filterYR ( const vpImage< vpRGBa > &  I,
vpImage< vpRGBa > &  dIx,
const double *  filter,
unsigned int  size 
)
static

Referenced by filterY().

◆ filterYTopBorder() [1/2]

template<typename FilterType >
static FilterType vpImageFilter::filterYTopBorder ( const vpImage< double > &  I,
unsigned int  r,
unsigned int  c,
const FilterType *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 818 of file vpImageFilter.h.

◆ filterYTopBorder() [2/2]

template<typename FilterType >
static FilterType vpImageFilter::filterYTopBorder ( const vpImage< unsigned char > &  I,
unsigned int  r,
unsigned int  c,
const FilterType *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 691 of file vpImageFilter.h.

◆ filterYTopBorderB()

static double vpImageFilter::filterYTopBorderB ( const vpImage< vpRGBa > &  I,
unsigned int  r,
unsigned int  c,
const double *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 737 of file vpImageFilter.h.

Referenced by filterY().

◆ filterYTopBorderG()

static double vpImageFilter::filterYTopBorderG ( const vpImage< vpRGBa > &  I,
unsigned int  r,
unsigned int  c,
const double *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 722 of file vpImageFilter.h.

Referenced by filterY().

◆ filterYTopBorderR()

static double vpImageFilter::filterYTopBorderR ( const vpImage< vpRGBa > &  I,
unsigned int  r,
unsigned int  c,
const double *  filter,
unsigned int  size 
)
inlinestatic

Definition at line 707 of file vpImageFilter.h.

Referenced by filterY().

◆ gaussianBlur() [1/3]

template<typename FilterType >
static void vpImageFilter::gaussianBlur ( const vpImage< FilterType > &  I,
vpImage< FilterType > &  GI,
unsigned int  size = 7,
FilterType  sigma = 0.,
bool  normalize = true 
)
inlinestatic

Apply a Gaussian blur to a double image.

Template Parameters
FilterType: Either float, to accelerate the computation time, or double, to have greater precision.
Parameters
I: Input double image.
GI: Filtered image.
size: Filter size. This value should be odd.
sigma: Gaussian standard deviation. If it is equal to zero or negative, it is computed from filter size as sigma = (size-1)/6.
normalize: Flag indicating whether to normalize the filter coefficients or not.
See also
getGaussianKernel() to know which kernel is used.

Definition at line 904 of file vpImageFilter.h.

References vpImage< Type >::destroy().

◆ gaussianBlur() [2/3]

template<typename FilterType >
static void vpImageFilter::gaussianBlur ( const vpImage< unsigned char > &  I,
vpImage< FilterType > &  GI,
unsigned int  size = 7,
FilterType  sigma = 0.,
bool  normalize = true 
)
inlinestatic

Apply a Gaussian blur to an image.

Template Parameters
FilterType: Either float, to accelerate the computation time, or double, to have greater precision.
Parameters
I: Input image.
GI: Filtered image.
size: Filter size. This value should be odd.
sigma: Gaussian standard deviation. If it is equal to zero or negative, it is computed from filter size as sigma = (size-1)/6.
normalize: Flag indicating whether to normalize the filter coefficients or not.
See also
getGaussianKernel() to know which kernel is used.
Examples
grabV4l2MultiCpp11Thread.cpp, testImageFilter.cpp, and tutorial-image-filter.cpp.

Definition at line 878 of file vpImageFilter.h.

References vpImage< Type >::destroy().

Referenced by vp::unsharpMask().

◆ gaussianBlur() [3/3]

void vpImageFilter::gaussianBlur ( const vpImage< vpRGBa > &  I,
vpImage< vpRGBa > &  GI,
unsigned int  size = 7,
double  sigma = 0.,
bool  normalize = true 
)
static

Apply a Gaussian blur to RGB color image.

Parameters
I: Input image.
GI: Filtered image.
size: Filter size. This value should be odd.
sigma: Gaussian standard deviation. If it is equal to zero or negative, it is computed from filter size as sigma = (size-1)/6.
normalize: Flag indicating whether to normalize the filter coefficients or not.
See also
getGaussianKernel() to know which kernel is used.

Definition at line 524 of file vpImageFilter.cpp.

References vpImage< Type >::destroy(), filterX(), filterY(), and getGaussianKernel().

◆ gaussianFilter()

template<class T >
static double vpImageFilter::gaussianFilter ( const vpImage< T > &  fr,
unsigned int  r,
unsigned int  c 
)
inlinestatic

Apply a 5x5 Gaussian filter to an image pixel.

Parameters
fr: Image to filter
r: coordinates (row) of the pixel
c: coordinates (column) of the pixel

Definition at line 922 of file vpImageFilter.h.

◆ getGaussianDerivativeKernel()

template<typename FilterType >
static void vpImageFilter::getGaussianDerivativeKernel ( FilterType *  filter,
unsigned int  size,
FilterType  sigma = 0.,
bool  normalize = true 
)
inlinestatic

Return the coefficients of a Gaussian derivative filter that may be used to compute spatial image derivatives after applying a Gaussian blur.

Template Parameters
FilterType: Either float, to accelerate the computation time, or double, to have greater precision.
Parameters
filter: Pointer to the filter kernel that should refer to a (size+1)/2 array. The first value refers to the central coefficient, the next one to the right coefficients. Left coefficients could be deduced by symmetry.
size: Filter size. This value should be odd.
sigma: Gaussian standard deviation. If it is equal to zero or negative, it is computed from filter size as sigma = (size-1)/6.
normalize: Flag indicating whether to normalize the filter coefficients or not.

Definition at line 997 of file vpImageFilter.h.

References vpImageException::incorrectInitializationError, and vpMath::sqr().

Referenced by vpTemplateTracker::setGaussianFilterSize(), and vpTemplateTracker::vpTemplateTracker().

◆ getGaussianKernel()

template<typename FilterType >
static void vpImageFilter::getGaussianKernel ( FilterType *  filter,
unsigned int  size,
FilterType  sigma = 0.,
bool  normalize = true 
)
inlinestatic

Return the coefficients $G_i$ of a Gaussian filter.

Template Parameters
FilterType: Either float, to accelerate the computation time, or double, to have greater precision.
Parameters
[out]filter: Pointer to the half size filter kernel that should refer to a (size+1)/2 array. The first value refers to the central coefficient, the next one to the right coefficients. Left coefficients could be deduced by symmetry.
[in]size: Filter size. This value should be odd and positive.
[in]sigma: Gaussian standard deviation $ \sigma $. If it is equal to zero or negative, it is computed from filter size as sigma = (size-1)/6.
[in]normalize: Flag indicating whether to normalize the filter coefficients or not. In that case $\Sigma G_i = 1 $.

The function computes the (size+1)/2 values of the Gaussian filter coefficients $ G_i $ as:

\[ G_i = \frac{1}{\sigma \sqrt{2 \pi}} \exp{(-i^2 / (2. * \sigma^2))}\]

Definition at line 953 of file vpImageFilter.h.

References vpImageException::incorrectInitializationError, and vpMath::sqr().

Referenced by gaussianBlur(), vpTemplateTracker::setGaussianFilterSize(), and vpTemplateTracker::vpTemplateTracker().

◆ getGaussPyramidal()

void vpImageFilter::getGaussPyramidal ( const vpImage< unsigned char > &  I,
vpImage< unsigned char > &  GI 
)
static

◆ getGaussXPyramidal()

void vpImageFilter::getGaussXPyramidal ( const vpImage< unsigned char > &  I,
vpImage< unsigned char > &  GI 
)
static

◆ getGaussYPyramidal()

void vpImageFilter::getGaussYPyramidal ( const vpImage< unsigned char > &  I,
vpImage< unsigned char > &  GI 
)
static

◆ getGradX() [1/2]

template<typename ImageType , typename FilterType >
static void vpImageFilter::getGradX ( const vpImage< ImageType > &  I,
vpImage< FilterType > &  dIx,
const FilterType *  filter,
unsigned int  size 
)
inlinestatic

◆ getGradX() [2/2]

◆ getGradXGauss2D()

template<typename ImageType , typename FilterType >
static void vpImageFilter::getGradXGauss2D ( const vpImage< ImageType > &  I,
vpImage< FilterType > &  dIx,
const FilterType *  gaussianKernel,
const FilterType *  gaussianDerivativeKernel,
unsigned int  size 
)
inlinestatic

◆ getGradY() [1/2]

template<typename ImageType , typename FilterType >
static void vpImageFilter::getGradY ( const vpImage< ImageType > &  I,
vpImage< FilterType > &  dIy,
const FilterType *  filter,
unsigned int  size 
)
inlinestatic

◆ getGradY() [2/2]

◆ getGradYGauss2D()

template<typename ImageType , typename FilterType >
static void vpImageFilter::getGradYGauss2D ( const vpImage< ImageType > &  I,
vpImage< FilterType > &  dIy,
const FilterType *  gaussianKernel,
const FilterType *  gaussianDerivativeKernel,
unsigned int  size 
)
inlinestatic

◆ getSobelKernelX()

template<typename FilterType >
static FilterType vpImageFilter::getSobelKernelX ( FilterType *  filter,
unsigned int  size 
)
inlinestatic

Get Sobel kernel for X-direction.

Template Parameters
FilterTypeEither float, to accelerate the computation time, or double, to have greater precision.
Parameters
filter: Pointer to a double array already allocated.
size: Kernel size computed as: kernel_size = size*2 + 1 (max size is 20).
Returns
Scaling factor.
Examples
testImageFilter.cpp.

Definition at line 1154 of file vpImageFilter.h.

References vpArray2D< Type >::data, vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), and vpArray2D< Type >::t().

Referenced by vpMbTracker::setProjectionErrorKernelSize(), and vpMbTracker::vpMbTracker().

◆ getSobelKernelY()

template<typename FilterType >
static FilterType vpImageFilter::getSobelKernelY ( FilterType *  filter,
unsigned int  size 
)
inlinestatic

Get Sobel kernel for Y-direction.

Template Parameters
FilterType: Either float, to accelerate the computation time, or double, to have greater precision.
Parameters
filter: Pointer to a double array already allocated.
size: Kernel size computed as: kernel_size = size*2 + 1 (max size is 20).
Returns
Scaling factor.

Definition at line 1175 of file vpImageFilter.h.

References vpArray2D< Type >::conv2(), vpArray2D< Type >::data, vpException::dimensionError, vpArray2D< Type >::getCols(), and vpArray2D< Type >::getRows().

Referenced by vpMbTracker::setProjectionErrorKernelSize(), and vpMbTracker::vpMbTracker().

◆ median() [1/3]

float vpImageFilter::median ( const cv::Mat &  channel)
static

Calculates the median value of a single channel. The algorithm is based on based on https://github.com/arnaudgelas/OpenCVExamples/blob/master/cvMat/Statistics/Median/Median.cpp.

Parameters
[in]channel: Single channel image in OpenCV format.
Examples
testImageFilter.cpp.

Definition at line 151 of file vpImageFilter.cpp.

Referenced by computeCannyThreshold(), and median().

◆ median() [2/3]

float vpImageFilter::median ( const vpImage< unsigned char > &  Isrc)
static

Calculates the median value of a single channel. The algorithm is based on based on https://github.com/arnaudgelas/OpenCVExamples/blob/master/cvMat/Statistics/Median/Median.cpp.

Parameters
[in]Isrc: Gray-level image in ViSP format.
Returns
Gray level image median value.
See also
vpImageFilter::median(const cv::Mat)

Definition at line 181 of file vpImageFilter.cpp.

References vpImageConvert::convert(), and median().

◆ median() [3/3]

std::vector< float > vpImageFilter::median ( const vpImage< vpRGBa > &  Isrc)
static

Calculates the median value of a vpRGBa image. The result is ordered in RGB format.

Parameters
[in]Isrc: RGB image in ViSP format. Alpha channel is ignored.
Returns
std::vector<float> meds such as meds[0] = red-channel-median, meds[1] = green-channel-median and meds[2] = blue-channel-median.
See also
vpImageFilter::median(const cv::Mat)

Definition at line 196 of file vpImageFilter.cpp.

References vpImageConvert::convert(), and median().

◆ sepFilter()

void vpImageFilter::sepFilter ( const vpImage< unsigned char > &  I,
vpImage< double > &  If,
const vpColVector kernelH,
const vpColVector kernelV 
)
static

Apply a filter to an image using two separable kernels. For instance, the Sobel kernel can be decomposed to:

\[ \left [ \begin{matrix} 1 & 0 & -1 \\ 2 & 0 & -2 \\ 1 & 0 & -1 \end{matrix} \right ] = \left [ \begin{matrix} 1 \\ 2 \\ 1 \end{matrix} \right ] \ast \left [ \begin{matrix} 1 & 0 & -1 \end{matrix} \right ] \]

Thus, the convolution operation can be performed as:

\[ G_x = \left [ \begin{matrix} 1 \\ 2 \\ 1 \end{matrix} \right ] \ast \left ( \left [ \begin{matrix} 1 & 0 & -1 \end{matrix} \right ] \ast I \right ) \]

Using two separable kernels reduce the number of operations and can be faster for large kernels.

Parameters
I: Image to filter
If: Filtered image.
kernelH: Separable kernel (performed first).
kernelV: Separable kernel (performed last).
Note
Only pixels in the input image fully covered by the kernel are considered.
Examples
testImageFilter.cpp.

Definition at line 113 of file vpImageFilter.cpp.

References vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpImage< Type >::resize(), and vpArray2D< Type >::size().