Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vpImageFilter Class Reference

#include <vpImageFilter.h>

Public Types

enum  vpCannyBackendType { CANNY_OPENCV_BACKEND = 0 , CANNY_VISP_BACKEND = 1 , CANNY_COUNT_BACKEND = 2 }
enum  vpCannyFilteringAndGradientType { CANNY_GBLUR_SOBEL_FILTERING = 0 , CANNY_GBLUR_SCHARR_FILTERING = 1 , CANNY_COUNT_FILTERING = 2 }
typedef enum vpImageFilter::vpCannyBackendType vpCannyBackendType
typedef enum vpImageFilter::vpCannyFilteringAndGradientType vpCannyFilteringAndGradientType

Static Public Member Functions

static std::string vpCannyBackendTypeList (const std::string &pref="<", const std::string &sep=" , ", const std::string &suf=">")
static std::string vpCannyBackendTypeToString (const vpCannyBackendType &type)
static vpCannyBackendType vpCannyBackendTypeFromString (const std::string &name)
static std::string vpGetCannyFiltAndGradTypes (const std::string &pref="<", const std::string &sep=" , ", const std::string &suf=">")
static std::string vpCannyFiltAndGradTypeToStr (const vpCannyFilteringAndGradientType &type)
static vpCannyFilteringAndGradientType vpCannyFiltAndGradTypeFromStr (const std::string &name)
static void canny (const vpImage< unsigned char > &I, vpImage< unsigned char > &Ic, const unsigned int &gaussianFilterSize, const float &thresholdCanny, const unsigned int &apertureSobel)
static void canny (const vpImage< unsigned char > &I, vpImage< unsigned char > &Ic, const unsigned int &gaussianFilterSize, const float &lowerThresholdCanny, const float &higherThresholdCanny, const unsigned int &apertureSobel)
static void canny (const vpImage< unsigned char > &I, vpImage< unsigned char > &Ic, const unsigned int &gaussianFilterSize, const float &lowerThresholdCanny, const float &higherThresholdCanny, const unsigned int &apertureSobel, const float &gaussianStdev, const float &lowerThresholdRatio, const float &upperThresholdRatio, const bool &normalizeGradients, const vpCannyBackendType &cannyBackend, const vpCannyFilteringAndGradientType &cannyFilteringSteps, const vpImage< bool > *p_mask=nullptr)
static float computeCannyThreshold (const cv::Mat &cv_I, const cv::Mat *p_cv_dIx, const cv::Mat *p_cv_dIy, float &lowerThresh, const unsigned int &gaussianKernelSize=5, const float &gaussianStdev=2.f, const unsigned int &apertureGradient=3, const float &lowerThresholdRatio=0.6f, const float &upperThresholdRatio=0.8f, const vpCannyFilteringAndGradientType &filteringType=CANNY_GBLUR_SOBEL_FILTERING)
static void computePartialDerivatives (const cv::Mat &cv_I, cv::Mat &cv_dIx, cv::Mat &cv_dIy, const bool &computeDx=true, const bool &computeDy=true, const bool &normalize=true, const unsigned int &gaussianKernelSize=5, const float &gaussianStdev=2.f, const unsigned int &apertureGradient=3, const vpCannyFilteringAndGradientType &filteringType=CANNY_GBLUR_SOBEL_FILTERING)
template<typename ImageType, typename FilterType>
static void computePartialDerivatives (const vpImage< ImageType > &I, vpImage< FilterType > &dIx, vpImage< FilterType > &dIy, const bool &computeDx=true, const bool &computeDy=true, const bool &normalize=true, const unsigned int &gaussianKernelSize=5, const FilterType &gaussianStdev=2.f, const unsigned int &apertureGradient=3, const vpCannyFilteringAndGradientType &filteringType=CANNY_GBLUR_SOBEL_FILTERING, const vpCannyBackendType &backend=CANNY_VISP_BACKEND, const vpImage< bool > *p_mask=nullptr)
template<typename FilterType>
static void computePartialDerivatives (const vpImage< vpRGBa > &I, vpImage< FilterType > &dIx, vpImage< FilterType > &dIy, const bool &computeDx=true, const bool &computeDy=true, const bool &normalize=true, const unsigned int &gaussianKernelSize=5, const FilterType &gaussianStdev=2.f, const unsigned int &apertureGradient=3, const vpCannyFilteringAndGradientType &filteringType=CANNY_GBLUR_SOBEL_FILTERING, const vpCannyBackendType &backend=CANNY_VISP_BACKEND, const vpImage< bool > *p_mask=nullptr)=delete
template<typename ImageType>
static void computePartialDerivatives (const vpImage< ImageType > &I, vpImage< unsigned char > &dIx, vpImage< unsigned char > &dIy, const bool &computeDx=true, const bool &computeDy=true, const bool &normalize=true, const unsigned int &gaussianKernelSize=5, const unsigned char &gaussianStdev=2.f, const unsigned int &apertureGradient=3, const vpCannyFilteringAndGradientType &filteringType=CANNY_GBLUR_SOBEL_FILTERING, const vpCannyBackendType &backend=CANNY_VISP_BACKEND, const vpImage< bool > *p_mask=nullptr)=delete
template<typename ImageType>
static void computePartialDerivatives (const vpImage< ImageType > &I, vpImage< vpRGBa > &dIx, vpImage< vpRGBa > &dIy, const bool &computeDx=true, const bool &computeDy=true, const bool &normalize=true, const unsigned int gaussianKernelSize=5, const vpRGBa gaussianStdev=vpRGBa(), const unsigned int apertureGradient=3, const vpCannyFilteringAndGradientType &filteringType=CANNY_GBLUR_SOBEL_FILTERING, const vpCannyBackendType &backend=CANNY_VISP_BACKEND, const vpImage< bool > *p_mask=nullptr)=delete
template<typename OutType>
static float computeCannyThreshold (const vpImage< unsigned char > &I, float &lowerThresh, const vpImage< OutType > *p_dIx=nullptr, const vpImage< OutType > *p_dIy=nullptr, const unsigned int &gaussianKernelSize=5, const OutType &gaussianStdev=2.f, const unsigned int &apertureGradient=3, const float &lowerThresholdRatio=0.6f, const float &upperThresholdRatio=0.8f, const vpCannyFilteringAndGradientType &filteringType=CANNY_GBLUR_SOBEL_FILTERING, const vpImage< bool > *p_mask=nullptr)
template<typename ArithmeticType, bool useFullScale, typename OutType>
static float computeCannyThreshold (const vpImage< vpHSV< ArithmeticType, useFullScale > > &I, float &lowerThresh, const vpImage< OutType > *p_dIx=nullptr, const vpImage< OutType > *p_dIy=nullptr, const unsigned int &gaussianKernelSize=5, const OutType &gaussianStdev=2.f, const float &lowerThresholdRatio=0.6f, const float &upperThresholdRatio=0.8f, const vpCannyFilteringAndGradientType &filteringType=CANNY_GBLUR_SOBEL_FILTERING, const vpImage< bool > *p_mask=nullptr)
template<class ImageType>
static double derivativeFilterX (const vpImage< ImageType > &I, unsigned int r, unsigned int c)
template<class ImageType>
static double derivativeFilterY (const vpImage< ImageType > &I, unsigned int r, unsigned int c)
template<class ImageType, typename FilterType>
static FilterType derivativeFilterX (const vpImage< ImageType > &I, unsigned int r, unsigned int c, const FilterType *filter, unsigned int size)
template<class ImageType, typename FilterType>
static FilterType derivativeFilterY (const vpImage< ImageType > &I, unsigned int r, unsigned int c, const FilterType *filter, unsigned int size)
template<typename ImageType, typename FilterType>
static void filter (const vpImage< ImageType > &I, vpImage< FilterType > &If, const vpArray2D< FilterType > &M, bool convolve=false, const vpImage< bool > *p_mask=nullptr)
template<typename FilterType>
static FilterType filter (const vpImage< FilterType > &I, const vpArray2D< FilterType > &M, unsigned int row, unsigned int col)
template<typename FilterType>
static void filter (const vpImage< vpRGBa > &I, vpImage< FilterType > &If, const vpArray2D< FilterType > &M, bool convolve=false)=delete
template<typename ImageType, typename FilterType>
static void filter (const vpImage< ImageType > &I, vpImage< FilterType > &Iu, vpImage< FilterType > &Iv, const vpArray2D< FilterType > &M, bool convolve=false, const vpImage< bool > *p_mask=nullptr)
template<typename FilterType>
static void filter (const vpImage< vpRGBa > &I, vpImage< FilterType > &Iu, vpImage< FilterType > &Iv, const vpArray2D< FilterType > &M, bool convolve)=delete
template<typename ImageType>
static void filter (const vpImage< ImageType > &I, vpImage< ImageType > &Iu, vpImage< ImageType > &Iv, const vpArray2D< vpRGBa > &M, bool convolve)=delete
static void sepFilter (const vpImage< unsigned char > &I, vpImage< double > &If, const vpColVector &kernelH, const vpColVector &kernelV)
template<typename ImageType, typename FilterType>
static void filter (const vpImage< ImageType > &I, vpImage< FilterType > &GI, const FilterType *filter, unsigned int size, const vpImage< bool > *p_mask=nullptr)
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 ImageType, typename OutputType, typename FilterType>
static void filterX (const vpImage< ImageType > &I, vpImage< OutputType > &dIx, const FilterType *filter, unsigned int size, const vpImage< bool > *p_mask=nullptr)
template<typename ImageType, typename OutputType, typename FilterType>
static std::enable_if< std::is_arithmetic< ImageType >::value, void >::type filterX (const vpImage< ImageType > &I, OutputType &result, unsigned int r, unsigned int c, const FilterType *filter, unsigned int size)
template<typename ImageType, typename OutputType, typename FilterType>
static std::enable_if<!std::is_arithmetic< ImageType >::value, void >::type filterX (const vpImage< ImageType > &I, OutputType &result, unsigned int r, unsigned int c, const FilterType *filter, unsigned int size)
template<typename ImageType, typename OutputType, typename FilterType>
static void filterY (const vpImage< ImageType > &I, vpImage< OutputType > &dIy, const FilterType *filter, unsigned int size, const vpImage< bool > *p_mask=nullptr)
template<typename ImageType, typename OutputType, typename FilterType>
static std::enable_if< std::is_arithmetic< ImageType >::value, void >::type filterY (const vpImage< ImageType > &I, OutputType &result, unsigned int r, unsigned int c, const FilterType *filter, unsigned int size)
template<typename ImageType, typename OutputType, typename FilterType>
static std::enable_if<!std::is_arithmetic< ImageType >::value, void >::type filterY (const vpImage< ImageType > &I, OutputType &result, unsigned int r, unsigned int c, const FilterType *filter, unsigned int size)
template<typename ImageType, typename OutputType, typename FilterType = float>
static void gaussianBlur (const vpImage< ImageType > &I, vpImage< OutputType > &GI, unsigned int size=7, FilterType sigma=0., bool normalize=true, const vpImage< bool > *p_mask=nullptr)
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, const vpImage< bool > *p_mask=nullptr)
template<typename ImageType, typename FilterType>
static void getGradX (const vpImage< ImageType > &I, vpImage< FilterType > &dIx, const FilterType *filter, unsigned int size, const vpImage< bool > *p_mask=nullptr)
template<typename ImageType, typename FilterType>
static void getGradXGauss2D (const vpImage< ImageType > &I, vpImage< FilterType > &dIx, const FilterType *gaussianKernel, const FilterType *gaussianDerivativeKernel, unsigned int size, const vpImage< bool > *p_mask=nullptr)
template<typename ArithmeticType, typename FilterType, bool useFullScale>
static void gradientFilterX (const vpImage< vpHSV< ArithmeticType, useFullScale > > &I, vpImage< FilterType > &GIx, const int &nbThread, const vpImage< bool > *p_mask, const vpImageFilter::vpCannyFilteringAndGradientType &type)
template<typename FilterType>
static void getGradY (const vpImage< unsigned char > &I, vpImage< FilterType > &dIy, const vpImage< bool > *p_mask=nullptr)
template<typename ImageType, typename FilterType>
static void getGradY (const vpImage< ImageType > &I, vpImage< FilterType > &dIy, const FilterType *filter, unsigned int size, const vpImage< bool > *p_mask=nullptr)
template<typename ImageType, typename FilterType>
static void getGradYGauss2D (const vpImage< ImageType > &I, vpImage< FilterType > &dIy, const FilterType *gaussianKernel, const FilterType *gaussianDerivativeKernel, unsigned int size, const vpImage< bool > *p_mask=nullptr)
template<typename ArithmeticType, typename FilterType, bool useFullScale>
static void gradientFilterY (const vpImage< vpHSV< ArithmeticType, useFullScale > > &I, vpImage< FilterType > &GIy, const int &nbThread, const vpImage< bool > *p_mask, const vpImageFilter::vpCannyFilteringAndGradientType &type)
template<typename FilterType>
static FilterType getScharrKernelX (FilterType *filter, unsigned int size)
template<typename FilterType>
static FilterType getScharrKernelY (FilterType *filter, 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 median (const cv::Mat &cv_I)
static float median (const vpImage< unsigned char > &Isrc)
static std::vector< float > median (const vpImage< vpRGBa > &Isrc)
template<typename ArithmeticType, typename FilterType, bool useFullScale>
static void gradientFilter (const vpImage< vpHSV< ArithmeticType, useFullScale > > &I, vpImage< FilterType > &GIx, vpImage< FilterType > &GIy, const int &nbThread=-1, const vpImage< bool > *p_mask=nullptr, const vpImageFilter::vpCannyFilteringAndGradientType &type=CANNY_GBLUR_SCHARR_FILTERING)

Detailed Description

Various image filter, convolution, etc...

Tutorials
If you are interested in applying various filters on an image, you may have a look at:

Definition at line 88 of file vpImageFilter.h.

Member Typedef Documentation

◆ vpCannyBackendType

Canny filter backends for the edge detection operations.

◆ vpCannyFilteringAndGradientType

Canny filter and gradient operators to apply on the image before the edge detection stage.

Member Enumeration Documentation

◆ vpCannyBackendType

Canny filter backends for the edge detection operations.

Enumerator
CANNY_OPENCV_BACKEND 

Use OpenCV.

CANNY_VISP_BACKEND 

Use ViSP.

CANNY_COUNT_BACKEND 
Examples
tutorial-canny.cpp, and tutorial-circle-hough.cpp.

Definition at line 92 of file vpImageFilter.h.

◆ vpCannyFilteringAndGradientType

Canny filter and gradient operators to apply on the image before the edge detection stage.

Enumerator
CANNY_GBLUR_SOBEL_FILTERING 

Apply Gaussian blur + Sobel operator on the input image.

CANNY_GBLUR_SCHARR_FILTERING 

Apply Gaussian blur + Scharr operator on the input image.

CANNY_COUNT_FILTERING 
Examples
testHSVGradient.cpp, tutorial-canny-hsv.cpp, tutorial-canny.cpp, tutorial-circle-hough.cpp, and tutorial-compare-auto-gamma.cpp.

Definition at line 107 of file vpImageFilter.h.

Member Function Documentation

◆ canny() [1/3]

void vpImageFilter::canny ( const vpImage< unsigned char > & Isrc,
vpImage< unsigned char > & Ires,
const unsigned int & gaussianFilterSize,
const float & lowerThreshold,
const float & upperThreshold,
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 <visp3/core/vpImage.h>
#include <visp3/core/vpImageFilter.h>
#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif
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, const unsigned int &gaussianFilterSize, const float &thresholdCanny, const unsigned int &apertureSobel)
Definition of the vpImage class member functions.
Definition vpImage.h:131
Parameters
[in]Isrc: Image to apply the Canny edge detector to.
[out]Ires: Filtered image (255 means an edge, 0 otherwise).
[in]gaussianFilterSize: The size of the mask of the Gaussian filter to apply (an odd number).
[in]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 .
[in]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 .
[in]apertureSobel: Size of the mask for the Sobel operator (odd number).

Definition at line 384 of file vpImageFilter_canny.cpp.

References canny(), CANNY_GBLUR_SOBEL_FILTERING, CANNY_OPENCV_BACKEND, and CANNY_VISP_BACKEND.

◆ canny() [2/3]

void vpImageFilter::canny ( const vpImage< unsigned char > & Isrc,
vpImage< unsigned char > & Ires,
const unsigned int & gaussianFilterSize,
const float & lowerThreshold,
const float & upperThreshold,
const unsigned int & apertureGradient,
const float & gaussianStdev,
const float & lowerThresholdRatio,
const float & upperThresholdRatio,
const bool & normalizeGradients,
const vpCannyBackendType & cannyBackend,
const vpCannyFilteringAndGradientType & cannyFilteringSteps,
const vpImage< bool > * p_mask = nullptr )
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>
#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif
int main()
{
// Constants for the Canny operator.
const unsigned int gaussianFilterSize = 5;
const float gaussianStdev = 2.0f;
const float upperThresholdCanny = 15.f;
const float lowerThresholdCanny = 5.f;
const float upperThresholdRatio = 0.8f;
const float lowerThresholdRatio = 0.6f;
const unsigned int apertureSobel = 3;
const bool normalizeGradient = true;
const vpCannyBackendType cannyBackend = CANNY_OPENCV_BACKEND; // or CANNY_VISP_BACKEND;
const vpCannyFilteringAndGradientType filteringType = CANNY_GBLUR_SOBEL_FILTERING; // or CANNY_GBLUR_SCHARR_FILTERING
// 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,
gaussianStdev, lowerThresholdRatio, upperThresholdRatio, normalizeGradient,
cannyBackend, filteringType);
return (0);
}
vpCannyFilteringAndGradientType
Canny filter and gradient operators to apply on the image before the edge detection stage.
@ CANNY_GBLUR_SOBEL_FILTERING
Apply Gaussian blur + Sobel operator on the input image.
vpCannyBackendType
Canny filter backends for the edge detection operations.
@ CANNY_OPENCV_BACKEND
Use OpenCV.
Parameters
[in]Isrc: Image to apply the Canny edge detector to.
[out]Ires: Filtered image (255 means an edge, 0 otherwise).
[in]gaussianFilterSize: The size of the mask of the Gaussian filter to apply (an odd number).
[in]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.
[in]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 upper threshold.
[in]apertureGradient: Size of the mask for the gradient (Sobel or Scharr) operator (odd number).
[in]gaussianStdev: The standard deviation of the Gaussian filter to apply. If it is non-positive, it is computed from kernel size (gaussianKernelSize parameter) as $\sigma = 0.3*((gaussianKernelSize-1)*0.5 - 1) + 0.8$.
[in]lowerThresholdRatio: The ratio of the upper threshold the lower threshold must be equal to. It is used only if the user asks to compute the Canny thresholds.
[in]upperThresholdRatio: The ratio of pixels whose absolute gradient is lower or equal to define the upper threshold. It is used only if the user asks to compute the Canny thresholds.
[in]normalizeGradients: Needs to be true if asking to compute the upperThreshold, otherwise it depends on the user application and user-defined thresholds.
[in]cannyBackend: The backend to use to perform the Canny edge filtering.
[in]cannyFilteringSteps: The filtering + gradient operators to apply to compute the gradient in the early stage of the Canny algorithm.
[in]p_mask: Optional image mask that indicates where Canny edge detection has to be computed.

Definition at line 470 of file vpImageFilter_canny.cpp.

References vpException::badValue, CANNY_OPENCV_BACKEND, CANNY_VISP_BACKEND, computeCannyThreshold(), computePartialDerivatives(), vpImageConvert::convert(), vpCannyEdgeDetection::detect(), vpCannyEdgeDetection::setGradients(), and vpCannyEdgeDetection::setMask().

◆ canny() [3/3]

void vpImageFilter::canny ( const vpImage< unsigned char > & Isrc,
vpImage< unsigned char > & Ires,
const unsigned int & gaussianFilterSize,
const float & 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 <visp3/core/vpImage.h>
#include <visp3/core/vpImageFilter.h>
#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif
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
[in]Isrc: Image to apply the Canny edge detector to.
[out]Ires: Filtered image (255 means an edge, 0 otherwise).
[in]gaussianFilterSize: The size of the mask of the Gaussian filter to apply (an odd number).
[in]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 .
[in]apertureSobel: Size of the mask for the Sobel operator (odd number).
Examples
tutorial-canny.cpp, and tutorial-image-filter.cpp.

Definition at line 330 of file vpImageFilter_canny.cpp.

References canny().

Referenced by canny(), canny(), vpCircleHoughTransform::edgeDetection(), and vpMeNurbs::seekExtremitiesCanny().

◆ computeCannyThreshold() [1/3]

float vpImageFilter::computeCannyThreshold ( const cv::Mat & cv_I,
const cv::Mat * p_cv_dIx,
const cv::Mat * p_cv_dIy,
float & lowerThresh,
const unsigned int & gaussianKernelSize = 5,
const float & gaussianStdev = 2.f,
const unsigned int & apertureGradient = 3,
const float & lowerThresholdRatio = 0.6f,
const float & upperThresholdRatio = 0.8f,
const vpCannyFilteringAndGradientType & filteringType = CANNY_GBLUR_SOBEL_FILTERING )
static

Compute the upper Canny edge filter threshold, using Gaussian blur + Sobel or + Scharr operators to compute the gradient of the image.

Parameters
[in]cv_I: The image, in cv format.
[in]p_cv_dIx: If different from nullptr, the gradient of cv_I with regard to the horizontal axis.
[in]p_cv_dIy: If different from nullptr, the gradient of cv_I with regard to the vertical axis.
[out]lowerThresh: The lower threshold for the Canny edge filter.
[in]gaussianKernelSize: The size of the mask of the Gaussian filter to apply (an odd number).
[in]gaussianStdev: The standard deviation of the Gaussian filter to apply.
[in]apertureGradient: Size of the mask for the Sobel operator (odd number).
[in]lowerThresholdRatio: The ratio of the upper threshold the lower threshold must be equal to.
[in]upperThresholdRatio: The ratio of pixels whose absolute gradient Gabs is lower or equal to to define
[in]filteringType: The gradient filter to apply to compute the gradient, if p_cv_dIx and p_cv_dIy are nullptr. the upper threshold.
Returns
The upper Canny edge filter threshold.

Definition at line 204 of file vpImageFilter_canny.cpp.

References computePartialDerivatives(), and vpException::fatalError.

Referenced by canny(), vpCannyEdgeDetection::detect(), and vpCannyEdgeDetection::detect().

◆ computeCannyThreshold() [2/3]

template<typename OutType>
float vpImageFilter::computeCannyThreshold ( const vpImage< unsigned char > & I,
float & lowerThresh,
const vpImage< OutType > * p_dIx = nullptr,
const vpImage< OutType > * p_dIy = nullptr,
const unsigned int & gaussianKernelSize = 5,
const OutType & gaussianStdev = 2.f,
const unsigned int & apertureGradient = 3,
const float & lowerThresholdRatio = 0.6f,
const float & upperThresholdRatio = 0.8f,
const vpCannyFilteringAndGradientType & filteringType = CANNY_GBLUR_SOBEL_FILTERING,
const vpImage< bool > * p_mask = nullptr )
inlinestatic

Compute the upper Canny edge filter threshold, using Gaussian blur + Sobel or + Scharr operators to compute the gradient of the image.

Template Parameters
OutType: Either float, to accelerate the computation time, or double, to have greater precision.
Parameters
[in]I: The gray-scale image, in ViSP format.
[in]p_dIx: If different from nullptr, must contain the gradient of the image with regard to the horizontal axis.
[in]p_dIy: If different from nullptr, must contain the gradient of the image with regard to the vertical axis.
[in]lowerThresh: Canny lower threshold.
[in]gaussianKernelSize: The size of the mask of the Gaussian filter to apply (an odd number).
[in]gaussianStdev: The standard deviation of the Gaussian filter to apply.
[in]apertureGradient: Size of the mask for the Sobel operator (odd number).
[in]lowerThresholdRatio: The ratio of the upper threshold the lower threshold must be equal to.
[in]upperThresholdRatio: The ratio of pixels whose absolute gradient Gabs is lower or equal to define the upper threshold.
[in]filteringType: The gradient filter to apply to compute the gradient, if p_dIx and p_dIy are nullptr.
[in]p_mask: If different from nullptr , only the pixels for which p_mask is true will be considered.
Returns
The upper Canny edge filter threshold.

Definition at line 349 of file vpImageFilter.h.

References vpImage< Type >::bitmap, vpHistogram::calculate(), CANNY_GBLUR_SOBEL_FILTERING, CANNY_VISP_BACKEND, computePartialDerivatives(), vpException::fatalError, vpHistogram::getTotal(), and vpHistogram::setMask().

◆ computeCannyThreshold() [3/3]

template<typename ArithmeticType, bool useFullScale, typename OutType>
float vpImageFilter::computeCannyThreshold ( const vpImage< vpHSV< ArithmeticType, useFullScale > > & I,
float & lowerThresh,
const vpImage< OutType > * p_dIx = nullptr,
const vpImage< OutType > * p_dIy = nullptr,
const unsigned int & gaussianKernelSize = 5,
const OutType & gaussianStdev = 2.f,
const float & lowerThresholdRatio = 0.6f,
const float & upperThresholdRatio = 0.8f,
const vpCannyFilteringAndGradientType & filteringType = CANNY_GBLUR_SOBEL_FILTERING,
const vpImage< bool > * p_mask = nullptr )
inlinestatic

Compute the upper Canny edge filter threshold for a HSV image.

Template Parameters
ArithmeticType: The type of encoding of the channels of the HSV image.
useFullScale: When using unsigned char, true means that Hue is encoded on the range [0; 255], otherwise it uses the limited range as defined in the vpHSV class.
OutType: Either float, to accelerate the computation time, or double, to have greater precision.
Parameters
[in]I: The HSV image.
[in]p_dIx: If different from nullptr, must contain the gradient of the image with regard to the horizontal axis.
[in]p_dIy: If different from nullptr, must contain the gradient of the image with regard to the vertical axis.
[in]lowerThresh: Canny lower threshold.
[in]gaussianKernelSize: The size of the mask of the Gaussian filter to apply (an odd number).
[in]gaussianStdev: The standard deviation of the Gaussian filter to apply.
[in]lowerThresholdRatio: The ratio of the upper threshold the lower threshold must be equal to.
[in]upperThresholdRatio: The ratio of pixels whose absolute gradient Gabs is lower or equal to define the upper threshold.
[in]filteringType: Canny filter type.
[in]p_mask: If different from nullptr , only the pixels for which p_mask is true will be considered.
Returns
The upper Canny edge filter threshold.

Definition at line 466 of file vpImageFilter.h.

References vpImage< Type >::bitmap, vpHistogram::calculate(), CANNY_GBLUR_SOBEL_FILTERING, vpException::fatalError, gaussianBlur(), vpHistogram::getTotal(), gradientFilter(), and vpHistogram::setMask().

◆ computePartialDerivatives() [1/5]

void vpImageFilter::computePartialDerivatives ( const cv::Mat & cv_I,
cv::Mat & cv_dIx,
cv::Mat & cv_dIy,
const bool & computeDx = true,
const bool & computeDy = true,
const bool & normalize = true,
const unsigned int & gaussianKernelSize = 5,
const float & gaussianStdev = 2.f,
const unsigned int & apertureGradient = 3,
const vpCannyFilteringAndGradientType & filteringType = CANNY_GBLUR_SOBEL_FILTERING )
static

Compute the partial derivatives (i.e. horizontal and vertical gradients) of the input image.

Parameters
[in]cv_IThe input image we want the partial derivatives.
[out]cv_dIxThe horizontal partial derivative, i.e. horizontal gradient.
[out]cv_dIyThe vertical partial derivative, i.e. vertical gradient.
[in]computeDxIndicate if we must compute the horizontal gradient.
[in]computeDyIndicate if we must compute the vertical gradient.
[in]normalizeIndicate if we must normalize the gradient filters.
[in]gaussianKernelSizeThe size of the kernel of the Gaussian filter used to blur the image.
[in]gaussianStdevThe standard deviation of the Gaussian filter used to blur the image. If it is non-positive, it is computed from kernel size (gaussianKernelSize parameter) as $\sigma = 0.3*((gaussianKernelSize-1)*0.5 - 1) + 0.8$.
[in]apertureGradientThe size of the kernel of the gradient filter.
[in]filteringTypeThe type of filters to apply to compute the gradients.
Examples
tutorial-canny.cpp, and tutorial-compare-auto-gamma.cpp.

Definition at line 588 of file vpImageFilter.cpp.

References CANNY_GBLUR_SCHARR_FILTERING, and CANNY_GBLUR_SOBEL_FILTERING.

Referenced by canny(), computeCannyThreshold(), computeCannyThreshold(), computePartialDerivatives(), and computePartialDerivatives().

◆ computePartialDerivatives() [2/5]

template<typename ImageType, typename FilterType>
void vpImageFilter::computePartialDerivatives ( const vpImage< ImageType > & I,
vpImage< FilterType > & dIx,
vpImage< FilterType > & dIy,
const bool & computeDx = true,
const bool & computeDy = true,
const bool & normalize = true,
const unsigned int & gaussianKernelSize = 5,
const FilterType & gaussianStdev = 2.f,
const unsigned int & apertureGradient = 3,
const vpCannyFilteringAndGradientType & filteringType = CANNY_GBLUR_SOBEL_FILTERING,
const vpCannyBackendType & backend = CANNY_VISP_BACKEND,
const vpImage< bool > * p_mask = nullptr )
inlinestatic

Compute the partial derivatives (i.e. horizontal and vertical gradients) of the input image.

Template Parameters
ImageTypeEither unsigned char, float or double
FilterTypeEither float or double.
Parameters
[in]IThe input image we want the partial derivatives.
[out]dIxThe horizontal partial derivative, i.e. horizontal gradient.
[out]dIyThe vertical partial derivative, i.e. vertical gradient.
[in]computeDxIndicate if we must compute the horizontal gradient.
[in]computeDyIndicate if we must compute the vertical gradient.
[in]normalizeIndicate if we must normalize the gradient filters.
[in]gaussianKernelSizeThe size of the kernel of the Gaussian filter used to blur the image. If it is non-positive, it is computed from kernel size (gaussianKernelSize parameter) as $\sigma = 0.3*((gaussianKernelSize-1)*0.5 - 1) + 0.8$.
[in]gaussianStdevThe standard deviation of the Gaussian filter used to blur the image.
[in]apertureGradientThe size of the kernel of the gradient filter.
[in]filteringTypeThe type of filters to apply to compute the gradients.
[in]backendThe type of backend to use to compute the gradients.
[in]p_maskIf different from nullptr, mask indicating which points to consider (true) or to ignore(false).

Definition at line 171 of file vpImageFilter.h.

References vpException::badValue, CANNY_GBLUR_SCHARR_FILTERING, CANNY_GBLUR_SOBEL_FILTERING, CANNY_OPENCV_BACKEND, CANNY_VISP_BACKEND, computePartialDerivatives(), vpImageConvert::convert(), filter(), gaussianBlur(), getScharrKernelX(), getScharrKernelY(), getSobelKernelX(), getSobelKernelY(), gradientFilterX(), gradientFilterY(), vpException::notImplementedError, vpImage< Type >::resize(), and vpCannyFiltAndGradTypeToStr().

◆ computePartialDerivatives() [3/5]

template<typename ImageType>
void vpImageFilter::computePartialDerivatives ( const vpImage< ImageType > & I,
vpImage< unsigned char > & dIx,
vpImage< unsigned char > & dIy,
const bool & computeDx = true,
const bool & computeDy = true,
const bool & normalize = true,
const unsigned int & gaussianKernelSize = 5,
const unsigned char & gaussianStdev = 2.f,
const unsigned int & apertureGradient = 3,
const vpCannyFilteringAndGradientType & filteringType = CANNY_GBLUR_SOBEL_FILTERING,
const vpCannyBackendType & backend = CANNY_VISP_BACKEND,
const vpImage< bool > * p_mask = nullptr )
inlinestaticdelete

◆ computePartialDerivatives() [4/5]

template<typename ImageType>
void vpImageFilter::computePartialDerivatives ( const vpImage< ImageType > & I,
vpImage< vpRGBa > & dIx,
vpImage< vpRGBa > & dIy,
const bool & computeDx = true,
const bool & computeDy = true,
const bool & normalize = true,
const unsigned int gaussianKernelSize = 5,
const vpRGBa gaussianStdev = vpRGBa(),
const unsigned int apertureGradient = 3,
const vpCannyFilteringAndGradientType & filteringType = CANNY_GBLUR_SOBEL_FILTERING,
const vpCannyBackendType & backend = CANNY_VISP_BACKEND,
const vpImage< bool > * p_mask = nullptr )
inlinestaticdelete

◆ computePartialDerivatives() [5/5]

template<typename FilterType>
void vpImageFilter::computePartialDerivatives ( const vpImage< vpRGBa > & I,
vpImage< FilterType > & dIx,
vpImage< FilterType > & dIy,
const bool & computeDx = true,
const bool & computeDy = true,
const bool & normalize = true,
const unsigned int & gaussianKernelSize = 5,
const FilterType & gaussianStdev = 2.f,
const unsigned int & apertureGradient = 3,
const vpCannyFilteringAndGradientType & filteringType = CANNY_GBLUR_SOBEL_FILTERING,
const vpCannyBackendType & backend = CANNY_VISP_BACKEND,
const vpImage< bool > * p_mask = nullptr )
inlinestaticdelete

◆ derivativeFilterX() [1/2]

template<class ImageType>
double vpImageFilter::derivativeFilterX ( const vpImage< ImageType > & 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 608 of file vpImageFilter.h.

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

◆ derivativeFilterX() [2/2]

template<class ImageType, typename FilterType>
FilterType vpImageFilter::derivativeFilterX ( const vpImage< ImageType > & 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 643 of file vpImageFilter.h.

References filter().

◆ derivativeFilterY() [1/2]

template<class ImageType>
double vpImageFilter::derivativeFilterY ( const vpImage< ImageType > & 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 622 of file vpImageFilter.h.

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

◆ derivativeFilterY() [2/2]

template<class ImageType, typename FilterType>
FilterType vpImageFilter::derivativeFilterY ( const vpImage< ImageType > & 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 671 of file vpImageFilter.h.

References filter().

◆ filter() [1/7]

template<typename FilterType>
FilterType vpImageFilter::filter ( const vpImage< FilterType > & I,
const vpArray2D< FilterType > & M,
unsigned int row,
unsigned int col )
inlinestatic

Apply a filter at a given image location.

Template Parameters
FilterTypeImage and filter types: double or float
Parameters
IThe input image
rowThe row coordinate where the filter should be applied
colThe column coordinate where the filter should be applied
Mthe filter

Definition at line 780 of file vpImageFilter.h.

References vpArray2D< Type >::getCols(), and vpArray2D< Type >::getRows().

◆ filter() [2/7]

template<typename ImageType, typename FilterType>
void vpImageFilter::filter ( const vpImage< ImageType > & I,
vpImage< FilterType > & GI,
const FilterType * filter,
unsigned int size,
const vpImage< bool > * p_mask = nullptr )
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.
p_mask: If different from nullptr, mask indicating which points to consider (true) or to ignore(false).

Definition at line 904 of file vpImageFilter.h.

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

◆ filter() [3/7]

template<typename ImageType, typename FilterType>
void vpImageFilter::filter ( const vpImage< ImageType > & I,
vpImage< FilterType > & If,
const vpArray2D< FilterType > & M,
bool convolve = false,
const vpImage< bool > * p_mask = nullptr )
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.
p_mask: If different from nullptr, mask indicating which points to consider (true) or to ignore(false).
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, tutorial-canny-hsv.cpp, and tutorial-image-filter.cpp.

Definition at line 715 of file vpImageFilter.h.

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

Referenced by vpCircleHoughTransform::computeGradients(), computePartialDerivatives(), derivativeFilterX(), derivativeFilterY(), filter(), filter(), filter(), filterX(), filterX(), filterY(), filterY(), vpTemplateTracker::getGaussianBluredImage(), getGaussianDerivativeKernel(), getGaussianKernel(), getGradX(), getGradY(), vpTemplateTrackerMI::getMI(), vpTemplateTrackerMI::getMI256(), getScharrKernelX(), getScharrKernelY(), getSobelKernelX(), getSobelKernelY(), gradientFilterX(), gradientFilterY(), vpTemplateTrackerMIESM::initHessienDesired(), vpTemplateTrackerMIForwardAdditional::initHessienDesired(), vpTemplateTrackerMIForwardCompositional::initHessienDesired(), vpTemplateTrackerMIInverseCompositional::initHessienDesired(), vpTemplateTrackerZNCCForwardAdditional::initHessienDesired(), vpTemplateTrackerZNCCInverseCompositional::initHessienDesired(), vpTemplateTracker::initTracking(), vpTemplateTrackerMIESM::trackNoPyr(), vpTemplateTrackerMIForwardAdditional::trackNoPyr(), vpTemplateTrackerMIForwardCompositional::trackNoPyr(), vpTemplateTrackerMIInverseCompositional::trackNoPyr(), vpTemplateTrackerSSDESM::trackNoPyr(), vpTemplateTrackerSSDForwardAdditional::trackNoPyr(), vpTemplateTrackerSSDForwardCompositional::trackNoPyr(), vpTemplateTrackerSSDInverseCompositional::trackNoPyr(), vpTemplateTrackerZNCCForwardAdditional::trackNoPyr(), and vpTemplateTrackerZNCCInverseCompositional::trackNoPyr().

◆ filter() [4/7]

template<typename ImageType, typename FilterType>
void vpImageFilter::filter ( const vpImage< ImageType > & I,
vpImage< FilterType > & Iu,
vpImage< FilterType > & Iv,
const vpArray2D< FilterType > & M,
bool convolve = false,
const vpImage< bool > * p_mask = nullptr )
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.
p_mask: If different from nullptr, mask indicating which points to consider (true) or to ignore(false).

Definition at line 817 of file vpImageFilter.h.

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

◆ filter() [5/7]

template<typename ImageType>
void vpImageFilter::filter ( const vpImage< ImageType > & I,
vpImage< ImageType > & Iu,
vpImage< ImageType > & Iv,
const vpArray2D< vpRGBa > & M,
bool convolve )
staticdelete

References filter(), and sepFilter().

◆ filter() [6/7]

template<typename FilterType>
void vpImageFilter::filter ( const vpImage< vpRGBa > & I,
vpImage< FilterType > & If,
const vpArray2D< FilterType > & M,
bool convolve = false )
staticdelete

References filter().

◆ filter() [7/7]

template<typename FilterType>
void vpImageFilter::filter ( const vpImage< vpRGBa > & I,
vpImage< FilterType > & Iu,
vpImage< FilterType > & Iv,
const vpArray2D< FilterType > & M,
bool convolve )
staticdelete

◆ filterGaussXPyramidal()

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

Definition at line 912 of file vpImageFilter.h.

Referenced by getGaussXPyramidal().

◆ filterGaussYPyramidal()

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

Definition at line 917 of file vpImageFilter.h.

Referenced by getGaussYPyramidal().

◆ filterX() [1/3]

template<typename ImageType, typename OutputType, typename FilterType>
std::enable_if<!std::is_arithmetic< ImageType >::value, void >::type vpImageFilter::filterX ( const vpImage< ImageType > & I,
OutputType & result,
unsigned int r,
unsigned int c,
const FilterType * filter,
unsigned int size )
inlinestatic

Filter along the horizontal direction "in the middle" of the image (i.e not on a border).

Template Parameters
ImageTypeThe type of pixels. In this case, it must be a color type (vpRGBa, vpHSV).
OutputTypeThe type of pixels in the resulting image. It can be an arithmetic type or a color type (vpRGBa, vpHSV).
FilterTypeAn arithmetic type.
Parameters
[in]IThe image that must be filtered.
[in]resultThe pixel resulting from the filtering operation.
[in]rThe row index.
[in]cThe column index.
[in]filterThe coefficients of the filter.
[in]sizeThe size of the filter.
Returns
The method is enabled only for color input type.

Definition at line 1203 of file vpImageFilter.h.

References filter().

◆ filterX() [2/3]

template<typename ImageType, typename OutputType, typename FilterType>
std::enable_if< std::is_arithmetic< ImageType >::value, void >::type vpImageFilter::filterX ( const vpImage< ImageType > & I,
OutputType & result,
unsigned int r,
unsigned int c,
const FilterType * filter,
unsigned int size )
inlinestatic

Filter along the horizontal direction "in the middle" of the image (i.e not on a border).

Template Parameters
ImageTypeThe type of pixels. In this case, it must be an arithmetic type.
OutputTypeThe type of pixels in the resulting image. In this case, it must be an arithmetic type.
FilterTypeAn arithmetic type.
Parameters
[in]IThe image that must be filtered.
[in]resultThe pixel resulting from the filtering operation.
[in]rThe row index.
[in]cThe column index.
[in]filterThe coefficients of the filter.
[in]sizeThe size of the filter.
Returns
The method is enabled only for arithmetic input type.

Definition at line 1176 of file vpImageFilter.h.

References filter().

◆ filterX() [3/3]

template<typename ImageType, typename OutputType, typename FilterType>
void vpImageFilter::filterX ( const vpImage< ImageType > & I,
vpImage< OutputType > & dIx,
const FilterType * filter,
unsigned int size,
const vpImage< bool > * p_mask = nullptr )
inlinestatic

Filter along the horizontal direction.

Template Parameters
ImageTypeThe type of pixels. It can be an arithmetic type or a color type (vpRGBa, vpHSV).
OutputTypeThe type of pixels in the resulting image. It can be an arithmetic type or a color type (vpRGBa, vpHSV).
FilterTypeAn arithmetic type.
Parameters
[in]IThe image that must be filtered.
[in]dIxThe image filtered along the horizontal direction.
[in]filterThe coefficients of the filter.
[in]sizeThe size of the filter.
[in]p_maskA boolean mask that permits to select the pixels that must be filtered if different from nullptr, unused otherwise.
Examples
testImageFilterHSVOldVSNew.cpp.

Definition at line 1102 of file vpImageFilter.h.

References filter(), and filterX().

Referenced by vpCircleHoughTransform::computeGradients(), filter(), filterX(), gaussianBlur(), and getGradYGauss2D().

◆ filterY() [1/3]

template<typename ImageType, typename OutputType, typename FilterType>
std::enable_if<!std::is_arithmetic< ImageType >::value, void >::type vpImageFilter::filterY ( const vpImage< ImageType > & I,
OutputType & result,
unsigned int r,
unsigned int c,
const FilterType * filter,
unsigned int size )
inlinestatic

Filter along the vertical direction "in the middle" of the image (i.e not on a border).

Template Parameters
ImageTypeThe type of pixels. In this case, it must be a color type (vpRGBa, vpHSV).
OutputTypeThe type of pixels in the resulting image. It can be an arithmetic type or a color type (vpRGBa, vpHSV).
FilterTypeAn arithmetic type.
Parameters
[in]IThe image that must be filtered.
[in]resultThe pixel resulting from the filtering operation.
[in]rThe row index.
[in]cThe column index.
[in]filterThe coefficients of the filter.
[in]sizeThe size of the filter.
Returns
The method is enabled only for color input type.

Definition at line 1596 of file vpImageFilter.h.

References filter().

◆ filterY() [2/3]

template<typename ImageType, typename OutputType, typename FilterType>
std::enable_if< std::is_arithmetic< ImageType >::value, void >::type vpImageFilter::filterY ( const vpImage< ImageType > & I,
OutputType & result,
unsigned int r,
unsigned int c,
const FilterType * filter,
unsigned int size )
inlinestatic

Filter along the vertical direction "in the middle" of the image (i.e not on a border).

Template Parameters
ImageTypeThe type of pixels. In this case, it must be an arithmetic type.
OutputTypeThe type of pixels in the resulting image. In this case, it must be an arithmetic type.
FilterTypeAn arithmetic type.
Parameters
[in]IThe image that must be filtered.
[in]resultThe pixel resulting from the filtering operation.
[in]rThe row index.
[in]cThe column index.
[in]filterThe coefficients of the filter.
[in]sizeThe size of the filter.
Returns
The method is enabled only for arithmetic input type.

Definition at line 1569 of file vpImageFilter.h.

References filter().

◆ filterY() [3/3]

template<typename ImageType, typename OutputType, typename FilterType>
void vpImageFilter::filterY ( const vpImage< ImageType > & I,
vpImage< OutputType > & dIy,
const FilterType * filter,
unsigned int size,
const vpImage< bool > * p_mask = nullptr )
inlinestatic

Filter along the vertical direction.

Template Parameters
ImageTypeThe type of pixels. It can be an arithmetic type or a color type (vpRGBa, vpHSV).
OutputTypeThe type of pixels in the resulting image. It can be an arithmetic type or a color type (vpRGBa, vpHSV).
FilterTypeAn arithmetic type.
Parameters
[in]IThe image that must be filtered.
[in]dIyThe image filtered along the vertical direction.
[in]filterThe coefficients of the filter.
[in]sizeThe size of the filter.
[in]p_maskA boolean mask that permits to select the pixels that must be filtered if different from nullptr, unused otherwise.
Examples
testImageFilterHSVOldVSNew.cpp.

Definition at line 1493 of file vpImageFilter.h.

References filter(), and filterY().

Referenced by vpCircleHoughTransform::computeGradients(), filter(), filterY(), gaussianBlur(), and getGradXGauss2D().

◆ gaussianBlur()

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

Apply a Gaussian blur to an image.

Template Parameters
ImageType: Either an arithmetic type or a color image.
OutputType: Either the same type than the ImageType, for color images, or an arithmetic type.
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.
p_mask: If different from nullptr, mask indicating which points to consider (true) or to ignore(false).
See also
getGaussianKernel() to know which kernel is used.
Examples
grabV4l2MultiCpp11Thread.cpp, perfGaussianFilter.cpp, testImageFilter.cpp, testImageFilterHSVOldVSNew.cpp, tutorial-canny-hsv.cpp, and tutorial-image-filter.cpp.

Definition at line 1776 of file vpImageFilter.h.

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

Referenced by computeCannyThreshold(), computePartialDerivatives(), vpCannyEdgeDetection::detect(), VISP_NAMESPACE_NAME::gammaCorrectionSpatialBased(), VISP_NAMESPACE_NAME::gammaCorrectionSpatialBased(), VISP_NAMESPACE_NAME::MSRCR(), VISP_NAMESPACE_NAME::unsharpMask(), and VISP_NAMESPACE_NAME::unsharpMask().

◆ gaussianFilter()

template<class T>
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 1837 of file vpImageFilter.h.

◆ getGaussianDerivativeKernel()

template<typename FilterType>
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 1918 of file vpImageFilter.h.

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

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

◆ getGaussianKernel()

template<typename FilterType>
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))}\‍]

Examples
testImageFilterHSVOldVSNew.cpp.

Definition at line 1870 of file vpImageFilter.h.

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

Referenced by gaussianBlur(), vpCircleHoughTransform::initGaussianFilters(), 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

Definition at line 450 of file vpImageFilter.cpp.

References filterGaussXPyramidal(), and vpImage< Type >::resize().

Referenced by getGaussPyramidal().

◆ getGaussYPyramidal()

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

Definition at line 466 of file vpImageFilter.cpp.

References filterGaussYPyramidal(), and vpImage< Type >::resize().

Referenced by getGaussPyramidal().

◆ getGradX() [1/2]

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

Definition at line 1993 of file vpImageFilter.h.

References derivativeFilterX(), and filter().

◆ getGradX() [2/2]

template<typename FilterType>
void vpImageFilter::getGradX ( const vpImage< unsigned char > & I,
vpImage< FilterType > & dIx,
const vpImage< bool > * p_mask = nullptr )
inlinestatic

◆ getGradXGauss2D()

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

Compute the gradient along X after applying a gaussian filter along Y.

Template Parameters
FilterType: Either float, to accelerate the computation time, or double, to have greater precision.
Parameters
I: Input image
dIx: Gradient along X.
gaussianKernel: Gaussian kernel which values should be computed using vpImageFilter::getGaussianKernel().
gaussianDerivativeKernel: Gaussian derivative kernel which values should be computed using vpImageFilter::getGaussianDerivativeKernel().
size: Size of the Gaussian and Gaussian derivative kernels.
p_mask: If different from nullptr, mask indicating which points to consider (true) or to ignore(false).

Definition at line 2038 of file vpImageFilter.h.

References filterY(), and getGradX().

Referenced by vpTemplateTrackerMIInverseCompositional::initCompInverse(), vpTemplateTrackerZNCCInverseCompositional::initCompInverse(), vpTemplateTrackerMIESM::initHessienDesired(), vpTemplateTrackerMIForwardAdditional::initHessienDesired(), vpTemplateTrackerMIForwardCompositional::initHessienDesired(), vpTemplateTrackerZNCCForwardAdditional::initHessienDesired(), vpTemplateTrackerZNCCInverseCompositional::initHessienDesired(), vpTemplateTracker::initTracking(), vpTemplateTrackerMIESM::trackNoPyr(), vpTemplateTrackerMIForwardAdditional::trackNoPyr(), vpTemplateTrackerMIForwardCompositional::trackNoPyr(), vpTemplateTrackerSSDESM::trackNoPyr(), vpTemplateTrackerSSDForwardAdditional::trackNoPyr(), vpTemplateTrackerSSDForwardCompositional::trackNoPyr(), and vpTemplateTrackerZNCCForwardAdditional::trackNoPyr().

◆ getGradY() [1/2]

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

Definition at line 2138 of file vpImageFilter.h.

References derivativeFilterY(), and filter().

◆ getGradY() [2/2]

template<typename FilterType>
void vpImageFilter::getGradY ( const vpImage< unsigned char > & I,
vpImage< FilterType > & dIy,
const vpImage< bool > * p_mask = nullptr )
inlinestatic

◆ getGradYGauss2D()

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

Compute the gradient along Y after applying a gaussian filter along X.

Template Parameters
FilterType: Either float, to accelerate the computation time, or double, to have greater precision.
Parameters
I: Input image
dIy: Gradient along Y.
gaussianKernel: Gaussian kernel which values should be computed using vpImageFilter::getGaussianKernel().
gaussianDerivativeKernel: Gaussian derivative kernel which values should be computed using vpImageFilter::getGaussianDerivativeKernel().
size: Size of the Gaussian and Gaussian derivative kernels.
p_mask: If different from nullptr, mask indicating which points to consider (true) or to ignore(false).

Definition at line 2189 of file vpImageFilter.h.

References filterX(), and getGradY().

Referenced by vpTemplateTrackerMIInverseCompositional::initCompInverse(), vpTemplateTrackerZNCCInverseCompositional::initCompInverse(), vpTemplateTrackerMIESM::initHessienDesired(), vpTemplateTrackerMIForwardAdditional::initHessienDesired(), vpTemplateTrackerMIForwardCompositional::initHessienDesired(), vpTemplateTrackerZNCCForwardAdditional::initHessienDesired(), vpTemplateTrackerZNCCInverseCompositional::initHessienDesired(), vpTemplateTracker::initTracking(), vpTemplateTrackerMIESM::trackNoPyr(), vpTemplateTrackerMIForwardAdditional::trackNoPyr(), vpTemplateTrackerMIForwardCompositional::trackNoPyr(), vpTemplateTrackerSSDESM::trackNoPyr(), vpTemplateTrackerSSDForwardAdditional::trackNoPyr(), vpTemplateTrackerSSDForwardCompositional::trackNoPyr(), and vpTemplateTrackerZNCCForwardAdditional::trackNoPyr().

◆ getScharrKernelX()

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

Get Scharr kernel for X-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 to normalize the Scharr kernel.
Examples
tutorial-canny-hsv.cpp.

Definition at line 2260 of file vpImageFilter.h.

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

Referenced by computePartialDerivatives(), and vpCircleHoughTransform::initGradientFilters().

◆ getScharrKernelY()

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

Get Scharr 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 to normalize the Scharr kernel.
Examples
tutorial-canny-hsv.cpp.

Definition at line 2284 of file vpImageFilter.h.

References vpException::dimensionError, and filter().

Referenced by computePartialDerivatives(), getScharrKernelX(), and vpCircleHoughTransform::initGradientFilters().

◆ getSobelKernelX()

template<typename FilterType>
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 to normalize the Sobel kernel.
Examples
testImageFilter.cpp, and tutorial-canny-hsv.cpp.

Definition at line 2314 of file vpImageFilter.h.

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

Referenced by computePartialDerivatives(), vpCircleHoughTransform::initGradientFilters(), vpMbTracker::setProjectionErrorKernelSize(), and vpMbTracker::vpMbTracker().

◆ getSobelKernelY()

template<typename FilterType>
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 to normalize the Sobel kernel.
Examples
tutorial-canny-hsv.cpp.

Definition at line 2339 of file vpImageFilter.h.

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

Referenced by computePartialDerivatives(), getSobelKernelX(), vpCircleHoughTransform::initGradientFilters(), vpMbTracker::setProjectionErrorKernelSize(), and vpMbTracker::vpMbTracker().

◆ gradientFilter()

template<typename ArithmeticType, typename FilterType, bool useFullScale>
void vpImageFilter::gradientFilter ( const vpImage< vpHSV< ArithmeticType, useFullScale > > & I,
vpImage< FilterType > & GIx,
vpImage< FilterType > & GIy,
const int & nbThread = -1,
const vpImage< bool > * p_mask = nullptr,
const vpImageFilter::vpCannyFilteringAndGradientType & type = CANNY_GBLUR_SCHARR_FILTERING )
inlinestatic

Compute the horizontal and vertical gradients for HSV images.

Template Parameters
ArithmeticTypeThe encoding of the HSV channels.
FilterTypeThe type to use for the filter and the type of the resulting gradient image.
useFullScaleSee the documentation of the vpHSV class to have details on this template parameter.
Parameters
[in]IThe input image.
[in]GIxThe resulting gradient image along the X-axis.
[in]GIyThe resulting gradient image along the Y-axis.
[in]nbThreadThe number of threads to use to compute the gradient.
[in]p_maskOptional boolean mask to indicate which pixels should be considered and which should be ignored.
[in]typeThe type of the gradient filter.
Examples
testHSVGradient.cpp, and tutorial-canny-hsv.cpp.

Definition at line 2422 of file vpImageFilter.h.

References CANNY_GBLUR_SCHARR_FILTERING, gradientFilterX(), gradientFilterY(), and vpImage< Type >::resize().

Referenced by computeCannyThreshold(), and vpCannyEdgeDetection::detect().

◆ gradientFilterX()

template<typename ArithmeticType, typename FilterType, bool useFullScale>
void vpImageFilter::gradientFilterX ( const vpImage< vpHSV< ArithmeticType, useFullScale > > & I,
vpImage< FilterType > & GIx,
const int & nbThread,
const vpImage< bool > * p_mask,
const vpImageFilter::vpCannyFilteringAndGradientType & type )
inlinestatic

Gradient filter along the X-axis for HSV images.

Template Parameters
ArithmeticTypeThe encoding of the HSV channels.
FilterTypeThe type to use for the filter and the type of the resulting gradient image.
useFullScaleSee the documentation of the vpHSV class to have details on this template parameter.
Parameters
[in]IThe input image.
[in]GIxThe resulting gradient image along the X-axis.
[in]nbThreadThe number of threads to use to compute the gradient.
[in]p_maskOptional boolean mask to indicate which pixels should be considered and which should be ignored.
[in]typeThe type of the gradient filter.

Definition at line 2060 of file vpImageFilter.h.

References vpException::badValue, CANNY_GBLUR_SCHARR_FILTERING, CANNY_GBLUR_SOBEL_FILTERING, filter(), and vpImage< Type >::resize().

Referenced by computePartialDerivatives(), and gradientFilter().

◆ gradientFilterY()

template<typename ArithmeticType, typename FilterType, bool useFullScale>
void vpImageFilter::gradientFilterY ( const vpImage< vpHSV< ArithmeticType, useFullScale > > & I,
vpImage< FilterType > & GIy,
const int & nbThread,
const vpImage< bool > * p_mask,
const vpImageFilter::vpCannyFilteringAndGradientType & type )
inlinestatic

Gradient filter along the Y-axis for HSV images.

Template Parameters
ArithmeticTypeThe encoding of the HSV channels.
FilterTypeThe type to use for the filter and the type of the resulting gradient image.
useFullScaleSee the documentation of the vpHSV class to have details on this template parameter.
Parameters
[in]IThe input image.
[in]GIyThe resulting gradient image along the Y-axis.
[in]nbThreadThe number of threads to use to compute the gradient.
[in]p_maskOptional boolean mask to indicate which pixels should be considered and which should be ignored.
[in]typeThe type of the gradient filter.

Definition at line 2211 of file vpImageFilter.h.

References vpException::badValue, CANNY_COUNT_FILTERING, CANNY_GBLUR_SCHARR_FILTERING, CANNY_GBLUR_SOBEL_FILTERING, filter(), and vpImage< Type >::resize().

Referenced by computePartialDerivatives(), and gradientFilter().

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

Referenced by median(), 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 540 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 555 of file vpImageFilter.cpp.

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

◆ sepFilter()

BEGIN_VISP_NAMESPACE 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
[in]I: Image to filter
[out]If: Filtered image.
[in]kernelH: Separable kernel (performed first).
[in]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 129 of file vpImageFilter.cpp.

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

Referenced by filter().

◆ vpCannyBackendTypeFromString()

vpImageFilter::vpCannyBackendType vpImageFilter::vpCannyBackendTypeFromString ( const std::string & name)
static

Cast a string into a vpImageFilter::vpCannyBackendTypeToString.

Parameters
[in]nameThe name of the backend.
Returns
vpImageFilter::vpCannyBackendTypeToString The corresponding enumeration value.
Examples
tutorial-canny.cpp, and tutorial-circle-hough.cpp.

Definition at line 95 of file vpImageFilter_canny.cpp.

References CANNY_COUNT_BACKEND, vpIoTools::toLowerCase(), and vpCannyBackendTypeToString().

Referenced by vpCircleHoughTransform::vpCircleHoughTransformParams::from_json.

◆ vpCannyBackendTypeList()

BEGIN_VISP_NAMESPACE std::string vpImageFilter::vpCannyBackendTypeList ( const std::string & pref = "<",
const std::string & sep = " , ",
const std::string & suf = ">" )
static

Get the list of available vpCannyBackendType.

Parameters
[in]prefThe prefix of the list.
[in]sepThe separator between two elements of the list.
[in]sufThe suffix of the list.
Returns
std::string The list of available items.
Examples
tutorial-canny.cpp, and tutorial-circle-hough.cpp.

Definition at line 49 of file vpImageFilter_canny.cpp.

References CANNY_COUNT_BACKEND, and vpCannyBackendTypeToString().

◆ vpCannyBackendTypeToString()

std::string vpImageFilter::vpCannyBackendTypeToString ( const vpCannyBackendType & type)
static

◆ vpCannyFiltAndGradTypeFromStr()

vpImageFilter::vpCannyFilteringAndGradientType vpImageFilter::vpCannyFiltAndGradTypeFromStr ( const std::string & name)
static

◆ vpCannyFiltAndGradTypeToStr()

◆ vpGetCannyFiltAndGradTypes()

std::string vpImageFilter::vpGetCannyFiltAndGradTypes ( const std::string & pref = "<",
const std::string & sep = " , ",
const std::string & suf = ">" )
static

Get the list of available vpCannyFilteringAndGradientType.

Parameters
[in]prefThe prefix of the list.
[in]sepThe separator between two elements of the list.
[in]sufThe suffix of the list.
Returns
std::string The list of available items.
Examples
tutorial-canny-hsv.cpp, tutorial-canny.cpp, and tutorial-circle-hough.cpp.

Definition at line 121 of file vpImageFilter_canny.cpp.

References CANNY_COUNT_FILTERING, and vpCannyFiltAndGradTypeToStr().