ViSP  2.7.0
vpImageFilter Class Reference

#include <vpImageFilter.h>

Static Public Member Functions

static void filter (const vpImage< double > &I, vpImage< double > &Iu, vpImage< double > &Iv, const vpMatrix &M)
 
static void filter (const vpImage< unsigned char > &I, vpImage< double > &If, const vpMatrix &M)
 
static void canny (const vpImage< unsigned char > &I, vpImage< unsigned char > &Ic, const unsigned int gaussianFilterSize, const double thresholdCanny, const unsigned int apertureSobel)
 
template<class T >
static double gaussianFilter (vpImage< T > &fr, const unsigned int r, const unsigned int c)
 
template<class T >
static double derivativeFilterX (vpImage< T > &fr, const unsigned int r, const unsigned int c)
 
template<class T >
static double derivativeFilterY (vpImage< T > &fr, const unsigned int r, const unsigned int c)
 
static void coefficientGaussianDerivative (double *filter, const unsigned int t)
 
template<class T >
static double derivativeFilterX (vpImage< T > &I, const unsigned int r, const unsigned int c, double *filter, const unsigned int size)
 
template<class T >
static double derivativeFilterY (vpImage< T > &I, const unsigned int r, const unsigned int c, double *filter, const unsigned int size)
 

Detailed Description

Various image filter, convolution, etc...

Definition at line 71 of file vpImageFilter.h.

Member Function Documentation

void vpImageFilter::canny ( const vpImage< unsigned char > &  Isrc,
vpImage< unsigned char > &  Ires,
const unsigned int  gaussianFilterSize,
const double  thresholdCanny,
const 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 <visp/vpConfig.h>
#include <visp/vpImage.h>
#include <visp/vpImageFilter.h>
int main()
{
#if VISP_HAVE_OPENCV_VERSION >= 0x020100 // Cany uses OpenCV v>=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).

Definition at line 176 of file vpImageFilter.cpp.

References vpImageConvert::convert().

static void vpImageFilter::coefficientGaussianDerivative ( double *  filter,
const unsigned int  t 
)
inlinestatic

build a Gaussian Derivative filter

   \param filter : array (of size t/2) that contains the filter
   \param t : size of the filter
Warning
filter has to be deallocated

Definition at line 163 of file vpImageFilter.h.

References vpMath::sqr().

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

Apply a 1x3 Derivative Filter to an image pixel.

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

Definition at line 129 of file vpImageFilter.h.

Referenced by vpFeatureLuminance::buildFrom().

template<class T >
static double vpImageFilter::derivativeFilterX ( vpImage< T > &  I,
const unsigned int  r,
const unsigned int  c,
double *  filter,
const 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::coefficientGaussianDerivative().
size: size of the filter
See also
vpImageFilter::coefficientGaussianDerivative()

Definition at line 195 of file vpImageFilter.h.

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

Apply a 3x1 Derivative 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 146 of file vpImageFilter.h.

Referenced by vpFeatureLuminance::buildFrom().

template<class T >
static double vpImageFilter::derivativeFilterY ( vpImage< T > &  I,
const unsigned int  r,
const unsigned int  c,
double *  filter,
const 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::coefficientGaussianDerivative().
size: size of the filter
See also
vpImageFilter::coefficientGaussianDerivative()

Definition at line 226 of file vpImageFilter.h.

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

Apply a filter to an image.

Parameters
I: Image to filter
Iu: Filtered image along the horizontal axis (u = columns).
Iv: Filtered image along the vertical axis (v = rows).
M: Separate filter coefficients

Definition at line 99 of file vpImageFilter.cpp.

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

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

Apply a filter to an image.

Parameters
I: Image to filter
If: Filtered image.
M: Filter coefficients.

Definition at line 59 of file vpImageFilter.cpp.

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

template<class T >
static double vpImageFilter::gaussianFilter ( vpImage< T > &  fr,
const unsigned int  r,
const 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 102 of file vpImageFilter.h.