Visual Servoing Platform  version 3.4.0
vpImageFilter Class Reference

#include <vpImageFilter.h>

Static Public Member Functions

static void canny (const vpImage< unsigned char > &I, vpImage< unsigned char > &Ic, unsigned int gaussianFilterSize, double thresholdCanny, 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 >
static double derivativeFilterX (const vpImage< T > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
 
template<class T >
static double derivativeFilterY (const vpImage< T > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
 
static void filter (const vpImage< double > &I, vpImage< double > &Iu, vpImage< double > &Iv, const vpMatrix &M, bool convolve=false)
 
static void filter (const vpImage< unsigned char > &I, vpImage< double > &If, const vpMatrix &M, bool convolve=false)
 
static void sepFilter (const vpImage< unsigned char > &I, vpImage< double > &If, const vpColVector &kernelH, const vpColVector &kernelV)
 
static void filter (const vpImage< unsigned char > &I, vpImage< double > &GI, const double *filter, unsigned int size)
 
static void filter (const vpImage< double > &I, vpImage< double > &GI, const double *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)
 
static void filterX (const vpImage< unsigned char > &I, vpImage< double > &dIx, const double *filter, unsigned int size)
 
static void filterX (const vpImage< double > &I, vpImage< double > &dIx, const double *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)
 
static double filterX (const vpImage< unsigned char > &I, unsigned int r, unsigned int c, const double *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)
 
static double filterXLeftBorder (const vpImage< unsigned char > &I, unsigned int r, unsigned int c, const double *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)
 
static double filterXRightBorder (const vpImage< unsigned char > &I, unsigned int r, unsigned int c, const double *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)
 
static double filterX (const vpImage< double > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
 
static double filterXLeftBorder (const vpImage< double > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
 
static double filterXRightBorder (const vpImage< double > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
 
static void filterY (const vpImage< unsigned char > &I, vpImage< double > &dIx, const double *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)
 
static void filterY (const vpImage< double > &I, vpImage< double > &dIx, const double *filter, unsigned int size)
 
static double filterY (const vpImage< unsigned char > &I, unsigned int r, unsigned int c, const double *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)
 
static double filterYTopBorder (const vpImage< unsigned char > &I, unsigned int r, unsigned int c, const double *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)
 
static double filterYBottomBorder (const vpImage< unsigned char > &I, unsigned int r, unsigned int c, const double *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)
 
static double filterYTopBorder (const vpImage< double > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
 
static double filterYBottomBorder (const vpImage< double > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
 
static double filterY (const vpImage< double > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
 
static void gaussianBlur (const vpImage< unsigned char > &I, vpImage< double > &GI, unsigned int size=7, double 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)
 
static void gaussianBlur (const vpImage< double > &I, vpImage< double > &GI, unsigned int size=7, double 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)
 
static void getGaussianKernel (double *filter, unsigned int size, double sigma=0., bool normalize=true)
 
static void getGaussianDerivativeKernel (double *filter, unsigned int size, double sigma=0., bool normalize=true)
 
static void getGradX (const vpImage< unsigned char > &I, vpImage< double > &dIx)
 
static void getGradX (const vpImage< unsigned char > &I, vpImage< double > &dIx, const double *filter, unsigned int size)
 
static void getGradX (const vpImage< double > &I, vpImage< double > &dIx, const double *filter, unsigned int size)
 
static void getGradXGauss2D (const vpImage< unsigned char > &I, vpImage< double > &dIx, const double *gaussianKernel, const double *gaussianDerivativeKernel, unsigned int size)
 
static void getGradY (const vpImage< unsigned char > &I, vpImage< double > &dIy)
 
static void getGradY (const vpImage< unsigned char > &I, vpImage< double > &dIy, const double *filter, unsigned int size)
 
static void getGradY (const vpImage< double > &I, vpImage< double > &dIy, const double *filter, unsigned int size)
 
static void getGradYGauss2D (const vpImage< unsigned char > &I, vpImage< double > &dIy, const double *gaussianKernel, const double *gaussianDerivativeKernel, unsigned int size)
 
static double getSobelKernelX (double *filter, unsigned int size)
 
static double getSobelKernelY (double *filter, unsigned int size)
 

Detailed Description

Various image filter, convolution, etc...

Definition at line 67 of file vpImageFilter.h.

Member Function Documentation

void vpImageFilter::canny ( const vpImage< unsigned char > &  Isrc,
vpImage< unsigned char > &  Ires,
unsigned int  gaussianFilterSize,
double  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/vpConfig.h>
#include <visp3/core/vpImage.h>
#include <visp3/core/vpImageFilter.h>
int main()
{
#if VISP_HAVE_OPENCV_VERSION >= 0x020100 // Canny uses OpenCV >=2.1.0
// 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);
#endif
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 threshold for the Canny operator. Only value greater than this value are marked as an edge).
apertureSobel: Size of the mask for the Sobel operator (odd number).
Examples:
tutorial-image-filter.cpp.

Definition at line 298 of file vpImageFilter.cpp.

References vpImageConvert::convert().

Referenced by vpMeNurbs::seekExtremitiesCanny().

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 82 of file vpImageFilter.h.

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

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

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

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 117 of file vpImageFilter.h.

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().

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

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

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 144 of file vpImageFilter.h.

void vpImageFilter::filter ( const vpImage< double > &  I,
vpImage< double > &  Iu,
vpImage< double > &  Iv,
const vpMatrix M,
bool  convolve = false 
)
static

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} \]

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.
Examples:
testImageFilter.cpp, and tutorial-image-filter.cpp.

Definition at line 127 of file vpImageFilter.cpp.

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

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

void vpImageFilter::filter ( const vpImage< unsigned char > &  I,
vpImage< double > &  If,
const vpMatrix M,
bool  convolve = false 
)
static

Apply a filter to an image.

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.

Definition at line 77 of file vpImageFilter.cpp.

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

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

Apply a separable filter.

Definition at line 327 of file vpImageFilter.cpp.

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

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

Apply a separable filter.

Definition at line 339 of file vpImageFilter.cpp.

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

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

Definition at line 170 of file vpImageFilter.h.

Referenced by getGaussXPyramidal().

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

Definition at line 175 of file vpImageFilter.h.

Referenced by getGaussYPyramidal().

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

Definition at line 188 of file vpImageFilter.h.

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

Definition at line 368 of file vpImageFilter.h.

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

Referenced by filterX().

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

Definition at line 227 of file vpImageFilter.h.

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

Referenced by filterX().

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

Definition at line 214 of file vpImageFilter.h.

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

Definition at line 240 of file vpImageFilter.h.

Referenced by filterX().

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

Definition at line 381 of file vpImageFilter.h.

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

Definition at line 288 of file vpImageFilter.h.

Referenced by filterX().

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

Definition at line 272 of file vpImageFilter.h.

Referenced by filterX().

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

Definition at line 256 of file vpImageFilter.h.

Referenced by filterX().

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

Referenced by filterX().

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

Definition at line 201 of file vpImageFilter.h.

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

Definition at line 304 of file vpImageFilter.h.

References vpImage< Type >::getWidth().

Referenced by filterX().

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

Definition at line 397 of file vpImageFilter.h.

References vpImage< Type >::getWidth().

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

Definition at line 352 of file vpImageFilter.h.

References vpImage< Type >::getWidth().

Referenced by filterX().

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

Definition at line 336 of file vpImageFilter.h.

References vpImage< Type >::getWidth().

Referenced by filterX().

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

Definition at line 320 of file vpImageFilter.h.

References vpImage< Type >::getWidth().

Referenced by filterX().

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

Definition at line 419 of file vpImageFilter.h.

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

Definition at line 629 of file vpImageFilter.h.

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

Referenced by filterY().

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

Definition at line 456 of file vpImageFilter.h.

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

Definition at line 533 of file vpImageFilter.h.

References vpImage< Type >::getHeight().

Referenced by filterY().

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

Definition at line 613 of file vpImageFilter.h.

References vpImage< Type >::getHeight().

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

Definition at line 581 of file vpImageFilter.h.

References vpImage< Type >::getHeight().

Referenced by filterY().

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

Definition at line 565 of file vpImageFilter.h.

References vpImage< Type >::getHeight().

Referenced by filterY().

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

Definition at line 549 of file vpImageFilter.h.

References vpImage< Type >::getHeight().

Referenced by filterY().

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

Referenced by filterY().

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

Definition at line 444 of file vpImageFilter.h.

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

Referenced by filterY().

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

Definition at line 432 of file vpImageFilter.h.

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

Definition at line 469 of file vpImageFilter.h.

Referenced by filterY().

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

Definition at line 597 of file vpImageFilter.h.

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

Definition at line 517 of file vpImageFilter.h.

Referenced by filterY().

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

Definition at line 501 of file vpImageFilter.h.

Referenced by filterY().

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

Definition at line 485 of file vpImageFilter.h.

Referenced by filterY().

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

Apply a Gaussian blur to an 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.
Examples:
grabV4l2MultiCpp11Thread.cpp, testImageFilter.cpp, and tutorial-image-filter.cpp.

Definition at line 482 of file vpImageFilter.cpp.

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

Referenced by vp::unsharpMask().

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 505 of file vpImageFilter.cpp.

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

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

Apply a Gaussian blur to a double image.

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 528 of file vpImageFilter.cpp.

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

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 655 of file vpImageFilter.h.

void vpImageFilter::getGaussianDerivativeKernel ( double *  filter,
unsigned int  size,
double  sigma = 0.,
bool  normalize = true 
)
static

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

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 595 of file vpImageFilter.cpp.

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

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

void vpImageFilter::getGaussianKernel ( double *  filter,
unsigned int  size,
double  sigma = 0.,
bool  normalize = true 
)
static

Return the coefficients $G_i$ of a Gaussian filter.

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 cooefficients $ G_i $ as:

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

Definition at line 555 of file vpImageFilter.cpp.

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

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

void vpImageFilter::getGaussPyramidal ( const vpImage< unsigned char > &  I,
vpImage< unsigned char > &  GI 
)
static
void vpImageFilter::getGaussXPyramidal ( const vpImage< unsigned char > &  I,
vpImage< unsigned char > &  GI 
)
static
void vpImageFilter::getGaussYPyramidal ( const vpImage< unsigned char > &  I,
vpImage< unsigned char > &  GI 
)
static
void vpImageFilter::getGradX ( const vpImage< unsigned char > &  I,
vpImage< double > &  dIx,
const double *  filter,
unsigned int  size 
)
static
void vpImageFilter::getGradX ( const vpImage< double > &  I,
vpImage< double > &  dIx,
const double *  filter,
unsigned int  size 
)
static
void vpImageFilter::getGradXGauss2D ( const vpImage< unsigned char > &  I,
vpImage< double > &  dIx,
const double *  gaussianKernel,
const double *  gaussianDerivativeKernel,
unsigned int  size 
)
static
void vpImageFilter::getGradY ( const vpImage< unsigned char > &  I,
vpImage< double > &  dIy,
const double *  filter,
unsigned int  size 
)
static
void vpImageFilter::getGradY ( const vpImage< double > &  I,
vpImage< double > &  dIy,
const double *  filter,
unsigned int  size 
)
static
void vpImageFilter::getGradYGauss2D ( const vpImage< unsigned char > &  I,
vpImage< double > &  dIy,
const double *  gaussianKernel,
const double *  gaussianDerivativeKernel,
unsigned int  size 
)
static
double vpImageFilter::getSobelKernelX ( double *  filter,
unsigned int  size 
)
static

Get Sobel kernel for X-direction.

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 869 of file vpImageFilter.cpp.

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

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

double vpImageFilter::getSobelKernelY ( double *  filter,
unsigned int  size 
)
static

Get Sobel kernel for Y-direction.

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 889 of file vpImageFilter.cpp.

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

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

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 225 of file vpImageFilter.cpp.

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