OpenCV  4.9.0
Open Source Computer Vision
Modules | Functions
Extended Image Processing

Modules

 Structured forests for fast edge detection
 
 EdgeBoxes
 
 Filters
 
 Superpixels
 
 Image segmentation
 
 Fast line detector
 
 EdgeDrawing
 
 Fourier descriptors
 
 Binary morphology on run-length encoded image
 

Functions

void cv::ximgproc::anisotropicDiffusion (InputArray src, OutputArray dst, float alpha, float K, int niters)
 Performs anisotropic diffusion on an image. More...
 
void cv::ximgproc::edgePreservingFilter (InputArray src, OutputArray dst, int d, double threshold)
 Smoothes an image using the Edge-Preserving filter. More...
 
void cv::ximgproc::findEllipses (InputArray image, OutputArray ellipses, float scoreThreshold=0.7f, float reliabilityThreshold=0.5f, float centerDistanceThreshold=0.05f)
 Finds ellipses fastly in an image using projective invariant pruning. More...
 
void cv::ximgproc::niBlackThreshold (InputArray _src, OutputArray _dst, double maxValue, int type, int blockSize, double k, int binarizationMethod=BINARIZATION_NIBLACK, double r=128)
 Performs thresholding on input images using Niblack's technique or some of the popular variations it inspired. More...
 
Matx23d cv::ximgproc::PeiLinNormalization (InputArray I)
 Calculates an affine transformation that normalize given image using Pei&Lin Normalization. More...
 
void cv::ximgproc::PeiLinNormalization (InputArray I, OutputArray T)
 
void cv::ximgproc::thinning (InputArray src, OutputArray dst, int thinningType=THINNING_ZHANGSUEN)
 Applies a binary blob thinning operation, to achieve a skeletization of the input image. More...
 

Detailed Description

Function Documentation

◆ anisotropicDiffusion()

void cv::ximgproc::anisotropicDiffusion ( InputArray  src,
OutputArray  dst,
float  alpha,
float  K,
int  niters 
)
Python:
cv.ximgproc.anisotropicDiffusion(src, alpha, K, niters[, dst]) -> dst

#include <opencv2/ximgproc.hpp>

Performs anisotropic diffusion on an image.

The function applies Perona-Malik anisotropic diffusion to an image. This is the solution to the partial differential equation:

\[{\frac {\partial I}{\partial t}}={\mathrm {div}}\left(c(x,y,t)\nabla I\right)=\nabla c\cdot \nabla I+c(x,y,t)\Delta I\]

Suggested functions for c(x,y,t) are:

\[c\left(\|\nabla I\|\right)=e^{{-\left(\|\nabla I\|/K\right)^{2}}}\]

or

\[ c\left(\|\nabla I\|\right)={\frac {1}{1+\left({\frac {\|\nabla I\|}{K}}\right)^{2}}} \]

Parameters
srcSource image with 3 channels.
dstDestination image of the same size and the same number of channels as src .
alphaThe amount of time to step forward by on each iteration (normally, it's between 0 and 1).
Ksensitivity to the edges
nitersThe number of iterations

◆ edgePreservingFilter()

void cv::ximgproc::edgePreservingFilter ( InputArray  src,
OutputArray  dst,
int  d,
double  threshold 
)
Python:
cv.ximgproc.edgePreservingFilter(src, d, threshold[, dst]) -> dst

#include <opencv2/ximgproc/edgepreserving_filter.hpp>

Smoothes an image using the Edge-Preserving filter.

The function smoothes Gaussian noise as well as salt & pepper noise. For more details about this implementation, please see [ReiWoe18] Reich, S. and Wörgötter, F. and Dellen, B. (2018). A Real-Time Edge-Preserving Denoising Filter. Proceedings of the 13th International Joint Conference on Computer Vision, Imaging and Computer Graphics Theory and Applications (VISIGRAPP): Visapp, 85-94, 4. DOI: 10.5220/0006509000850094.

Parameters
srcSource 8-bit 3-channel image.
dstDestination image of the same size and type as src.
dDiameter of each pixel neighborhood that is used during filtering. Must be greater or equal 3.
thresholdThreshold, which distinguishes between noise, outliers, and data.

◆ findEllipses()

void cv::ximgproc::findEllipses ( InputArray  image,
OutputArray  ellipses,
float  scoreThreshold = 0.7f,
float  reliabilityThreshold = 0.5f,
float  centerDistanceThreshold = 0.05f 
)
Python:
cv.ximgproc.findEllipses(image[, ellipses[, scoreThreshold[, reliabilityThreshold[, centerDistanceThreshold]]]]) -> ellipses

#include <opencv2/ximgproc/find_ellipses.hpp>

Finds ellipses fastly in an image using projective invariant pruning.

The function detects ellipses in images using projective invariant pruning. For more details about this implementation, please see [133] Jia, Qi et al, (2017). A Fast Ellipse Detector using Projective Invariant Pruning. IEEE Transactions on Image Processing.

Parameters
imageinput image, could be gray or color.
ellipsesoutput vector of found ellipses. each vector is encoded as five float $x, y, a, b, radius, score$.
scoreThresholdfloat, the threshold of ellipse score.
reliabilityThresholdfloat, the threshold of reliability.
centerDistanceThresholdfloat, the threshold of center distance.

◆ niBlackThreshold()

void cv::ximgproc::niBlackThreshold ( InputArray  _src,
OutputArray  _dst,
double  maxValue,
int  type,
int  blockSize,
double  k,
int  binarizationMethod = BINARIZATION_NIBLACK,
double  r = 128 
)
Python:
cv.ximgproc.niBlackThreshold(_src, maxValue, type, blockSize, k[, _dst[, binarizationMethod[, r]]]) -> _dst

#include <opencv2/ximgproc.hpp>

Performs thresholding on input images using Niblack's technique or some of the popular variations it inspired.

The function transforms a grayscale image to a binary image according to the formulae:

  • THRESH_BINARY

    \[dst(x,y) = \fork{\texttt{maxValue}}{if \(src(x,y) > T(x,y)\)}{0}{otherwise}\]

  • THRESH_BINARY_INV

    \[dst(x,y) = \fork{0}{if \(src(x,y) > T(x,y)\)}{\texttt{maxValue}}{otherwise}\]

    where \(T(x,y)\) is a threshold calculated individually for each pixel.

The threshold value \(T(x, y)\) is determined based on the binarization method chosen. For classic Niblack, it is the mean minus \( k \) times standard deviation of \(\texttt{blockSize} \times\texttt{blockSize}\) neighborhood of \((x, y)\).

The function can't process the image in-place.

Parameters
_srcSource 8-bit single-channel image.
_dstDestination image of the same size and the same type as src.
maxValueNon-zero value assigned to the pixels for which the condition is satisfied, used with the THRESH_BINARY and THRESH_BINARY_INV thresholding types.
typeThresholding type, see cv::ThresholdTypes.
blockSizeSize of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on.
kThe user-adjustable parameter used by Niblack and inspired techniques. For Niblack, this is normally a value between 0 and 1 that is multiplied with the standard deviation and subtracted from the mean.
binarizationMethodBinarization method to use. By default, Niblack's technique is used. Other techniques can be specified, see cv::ximgproc::LocalBinarizationMethods.
rThe user-adjustable parameter used by Sauvola's technique. This is the dynamic range of standard deviation.
See also
threshold, adaptiveThreshold

◆ PeiLinNormalization() [1/2]

Matx23d cv::ximgproc::PeiLinNormalization ( InputArray  I)
Python:
cv.ximgproc.PeiLinNormalization(I[, T]) -> T

#include <opencv2/ximgproc/peilin.hpp>

Calculates an affine transformation that normalize given image using Pei&Lin Normalization.

Assume given image \(I=T(\bar{I})\) where \(\bar{I}\) is a normalized image and \(T\) is an affine transformation distorting this image by translation, rotation, scaling and skew. The function returns an affine transformation matrix corresponding to the transformation \(T^{-1}\) described in [PeiLin95]. For more details about this implementation, please see [PeiLin95] Soo-Chang Pei and Chao-Nan Lin. Image normalization for pattern recognition. Image and Vision Computing, Vol. 13, N.10, pp. 711-723, 1995.

Parameters
IGiven transformed image.
Returns
Transformation matrix corresponding to inversed image transformation

◆ PeiLinNormalization() [2/2]

void cv::ximgproc::PeiLinNormalization ( InputArray  I,
OutputArray  T 
)
Python:
cv.ximgproc.PeiLinNormalization(I[, T]) -> T

#include <opencv2/ximgproc/peilin.hpp>

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ thinning()

void cv::ximgproc::thinning ( InputArray  src,
OutputArray  dst,
int  thinningType = THINNING_ZHANGSUEN 
)
Python:
cv.ximgproc.thinning(src[, dst[, thinningType]]) -> dst

#include <opencv2/ximgproc.hpp>

Applies a binary blob thinning operation, to achieve a skeletization of the input image.

The function transforms a binary blob image into a skeletized form using the technique of Zhang-Suen.

Parameters
srcSource 8-bit single-channel image, containing binary blobs, with blobs having 255 pixel values.
dstDestination image of the same size and the same type as src. The function can work in-place.
thinningTypeValue that defines which thinning algorithm should be used. See cv::ximgproc::ThinningTypes