NAME
PDL::OpenCV::Imgproc - PDL bindings for OpenCV CLAHE, GeneralizedHough, GeneralizedHoughBallard, GeneralizedHoughGuil, LineSegmentDetector, Subdiv2D
SYNOPSIS
use PDL::OpenCV::Imgproc;
FUNCTIONS
getGaussianKernel
Signature: (int [phys] ksize(); double [phys] sigma(); int [phys] ktype(); [o,phys] res(l4,c4,r4))
Returns Gaussian filter coefficients. NO BROADCASTING.
$res = getGaussianKernel($ksize,$sigma); # with defaults
$res = getGaussianKernel($ksize,$sigma,$ktype);
The function computes and returns the \texttt{ksize} \times 1
matrix of Gaussian filter coefficients: \f[G_i= \alpha *e^{-(i-( \texttt{ksize} -1)/2)^2/(2* \texttt{sigma}^2)},\f] where i=0..\texttt{ksize}-1
and \alpha
is the scale factor chosen so that \sum_i G_i=1
. Two of such generated kernels can be passed to sepFilter2D. Those functions automatically recognize smoothing kernels (a symmetrical kernel with sum of weights equal to 1) and handle them accordingly. You may also use the higher-level GaussianBlur. \texttt{ksize} \mod 2 = 1
) and positive.
Parameters:
- ksize
-
Aperture size. It should be odd (
- sigma
-
Gaussian standard deviation. If it is non-positive, it is computed from ksize as `sigma = 0.3*((ksize-1)*0.5 - 1) + 0.8`.
- ktype
-
Type of filter coefficients. It can be CV_32F or CV_64F .
See also: sepFilter2D, getDerivKernels, getStructuringElement, GaussianBlur
getGaussianKernel ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
getDerivKernels
Signature: ([o,phys] kx(l1,c1,r1); [o,phys] ky(l2,c2,r2); int [phys] dx(); int [phys] dy(); int [phys] ksize(); byte [phys] normalize(); int [phys] ktype())
Returns filter coefficients for computing spatial image derivatives. NO BROADCASTING.
($kx,$ky) = getDerivKernels($dx,$dy,$ksize); # with defaults
($kx,$ky) = getDerivKernels($dx,$dy,$ksize,$normalize,$ktype);
The function computes and returns the filter coefficients for spatial image derivatives. When `ksize=FILTER_SCHARR`, the Scharr 3 \times 3
kernels are generated (see #Scharr). Otherwise, Sobel kernels are generated (see #Sobel). The filters are normally passed to #sepFilter2D or to =2^{ksize*2-dx-dy-2}
. If you are going to filter floating-point images, you are likely to use the normalized kernels. But if you compute derivatives of an 8-bit image, store the results in a 16-bit image, and wish to preserve all the fractional bits, you may want to set normalize=false .
Parameters:
- kx
-
Output matrix of row filter coefficients. It has the type ktype .
- ky
-
Output matrix of column filter coefficients. It has the type ktype .
- dx
-
Derivative order in respect of x.
- dy
-
Derivative order in respect of y.
- ksize
-
Aperture size. It can be FILTER_SCHARR, 1, 3, 5, or 7.
- normalize
-
Flag indicating whether to normalize (scale down) the filter coefficients or not. Theoretically, the coefficients should have the denominator
- ktype
-
Type of filter coefficients. It can be CV_32f or CV_64F .
getDerivKernels ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
getGaborKernel
Signature: (indx [phys] ksize(n1=2); double [phys] sigma(); double [phys] theta(); double [phys] lambd(); double [phys] gamma(); double [phys] psi(); int [phys] ktype(); [o,phys] res(l8,c8,r8))
Returns Gabor filter coefficients. NO BROADCASTING.
$res = getGaborKernel($ksize,$sigma,$theta,$lambd,$gamma); # with defaults
$res = getGaborKernel($ksize,$sigma,$theta,$lambd,$gamma,$psi,$ktype);
For more details about gabor filter equations and parameters, see: [Gabor Filter](http://en.wikipedia.org/wiki/Gabor_filter).
Parameters:
- ksize
-
Size of the filter returned.
- sigma
-
Standard deviation of the gaussian envelope.
- theta
-
Orientation of the normal to the parallel stripes of a Gabor function.
- lambd
-
Wavelength of the sinusoidal factor.
- gamma
-
Spatial aspect ratio.
- psi
-
Phase offset.
- ktype
-
Type of filter coefficients. It can be CV_32F or CV_64F .
getGaborKernel ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
getStructuringElement
Signature: (int [phys] shape(); indx [phys] ksize(n2=2); indx [phys] anchor(n3=2); [o,phys] res(l4,c4,r4))
Returns a structuring element of the specified size and shape for morphological operations. NO BROADCASTING.
$res = getStructuringElement($shape,$ksize); # with defaults
$res = getStructuringElement($shape,$ksize,$anchor);
The function constructs and returns the structuring element that can be further passed to #erode, #dilate or #morphologyEx. But you can also construct an arbitrary binary mask yourself and use it as the structuring element. (-1, -1)
means that the anchor is at the center. Note that only the shape of a cross-shaped element depends on the anchor position. In other cases the anchor just regulates how much the result of the morphological operation is shifted.
Parameters:
- shape
-
Element shape that could be one of #MorphShapes
- ksize
-
Size of the structuring element.
- anchor
-
Anchor position within the element. The default value
getStructuringElement ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
medianBlur
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); int [phys] ksize())
Blurs an image using the median filter. NO BROADCASTING.
$dst = medianBlur($src,$ksize);
The function smoothes an image using the median filter with the \texttt{ksize} \times \texttt{ksize}
aperture. Each channel of a multi-channel image is processed independently. In-place operation is supported. @note The median filter uses #BORDER_REPLICATE internally to cope with border pixels, see #BorderTypes
Parameters:
- src
-
input 1-, 3-, or 4-channel image; when ksize is 3 or 5, the image depth should be CV_8U, CV_16U, or CV_32F, for larger aperture sizes, it can only be CV_8U.
- dst
-
destination array of the same size and type as src.
- ksize
-
aperture linear size; it must be odd and greater than 1, for example: 3, 5, 7 ...
See also: bilateralFilter, blur, boxFilter, GaussianBlur
medianBlur ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
GaussianBlur
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); indx [phys] ksize(n3=2); double [phys] sigmaX(); double [phys] sigmaY(); int [phys] borderType())
Blurs an image using a Gaussian filter. NO BROADCASTING.
$dst = GaussianBlur($src,$ksize,$sigmaX); # with defaults
$dst = GaussianBlur($src,$ksize,$sigmaX,$sigmaY,$borderType);
The function convolves the source image with the specified Gaussian kernel. In-place filtering is supported.
Parameters:
- src
-
input image; the image can have any number of channels, which are processed independently, but the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
- dst
-
output image of the same size and type as src.
- ksize
-
Gaussian kernel size. ksize.width and ksize.height can differ but they both must be positive and odd. Or, they can be zero's and then they are computed from sigma.
- sigmaX
-
Gaussian kernel standard deviation in X direction.
- sigmaY
-
Gaussian kernel standard deviation in Y direction; if sigmaY is zero, it is set to be equal to sigmaX, if both sigmas are zeros, they are computed from ksize.width and ksize.height, respectively (see #getGaussianKernel for details); to fully control the result regardless of possible future modifications of all this semantics, it is recommended to specify all of ksize, sigmaX, and sigmaY.
- borderType
-
pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
See also: sepFilter2D, filter2D, blur, boxFilter, bilateralFilter, medianBlur
GaussianBlur ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
bilateralFilter
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); int [phys] d(); double [phys] sigmaColor(); double [phys] sigmaSpace(); int [phys] borderType())
Applies the bilateral filter to an image. NO BROADCASTING.
$dst = bilateralFilter($src,$d,$sigmaColor,$sigmaSpace); # with defaults
$dst = bilateralFilter($src,$d,$sigmaColor,$sigmaSpace,$borderType);
The function applies bilateral filtering to the input image, as described in http://www.dai.ed.ac.uk/CVonline/LOCAL_COPIES/MANDUCHI1/Bilateral_Filtering.html bilateralFilter can reduce unwanted noise very well while keeping edges fairly sharp. However, it is very slow compared to most filters. _Sigma values_: For simplicity, you can set the 2 sigma values to be the same. If they are small (\< 10), the filter will not have much effect, whereas if they are large (\> 150), they will have a very strong effect, making the image look "cartoonish". _Filter size_: Large filters (d \> 5) are very slow, so it is recommended to use d=5 for real-time applications, and perhaps d=9 for offline applications that need heavy noise filtering. This filter does not work inplace. \>0, it specifies the neighborhood size regardless of sigmaSpace. Otherwise, d is proportional to sigmaSpace.
Parameters:
- src
-
Source 8-bit or floating-point, 1-channel or 3-channel image.
- dst
-
Destination image of the same size and type as src .
- d
-
Diameter of each pixel neighborhood that is used during filtering. If it is non-positive, it is computed from sigmaSpace.
- sigmaColor
-
Filter sigma in the color space. A larger value of the parameter means that farther colors within the pixel neighborhood (see sigmaSpace) will be mixed together, resulting in larger areas of semi-equal color.
- sigmaSpace
-
Filter sigma in the coordinate space. A larger value of the parameter means that farther pixels will influence each other as long as their colors are close enough (see sigmaColor ). When d
- borderType
-
border mode used to extrapolate pixels outside of the image, see #BorderTypes
bilateralFilter ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
boxFilter
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); int [phys] ddepth(); indx [phys] ksize(n4=2); indx [phys] anchor(n5=2); byte [phys] normalize(); int [phys] borderType())
Blurs an image using the box filter. NO BROADCASTING.
$dst = boxFilter($src,$ddepth,$ksize); # with defaults
$dst = boxFilter($src,$ddepth,$ksize,$anchor,$normalize,$borderType);
The function smooths an image using the kernel: \f[\texttt{K} = \alpha \begin{bmatrix} 1 & 1 & 1 & \cdots & 1 & 1 \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \hdotsfor{6} \\ 1 & 1 & 1 & \cdots & 1 & 1 \end{bmatrix}\f] where \f[\alpha = \begin{cases} \frac{1}{\texttt{ksize.width*ksize.height}} & \texttt{when } \texttt{normalize=true} \\1 & \texttt{otherwise}\end{cases}\f] Unnormalized box filter is useful for computing various integral characteristics over each pixel neighborhood, such as covariance matrices of image derivatives (used in dense optical flow algorithms, and so on). If you need to compute pixel sums over variable-size windows, use #integral.
Parameters:
- src
-
input image.
- dst
-
output image of the same size and type as src.
- ddepth
-
the output image depth (-1 to use src.depth()).
- ksize
-
blurring kernel size.
- anchor
-
anchor point; default value Point(-1,-1) means that the anchor is at the kernel center.
- normalize
-
flag, specifying whether the kernel is normalized by its area or not.
- borderType
-
border mode used to extrapolate pixels outside of the image, see #BorderTypes. #BORDER_WRAP is not supported.
See also: blur, bilateralFilter, GaussianBlur, medianBlur, integral
boxFilter ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
sqrBoxFilter
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); int [phys] ddepth(); indx [phys] ksize(n4=2); indx [phys] anchor(n5=2); byte [phys] normalize(); int [phys] borderType())
Calculates the normalized sum of squares of the pixel values overlapping the filter. NO BROADCASTING.
$dst = sqrBoxFilter($src,$ddepth,$ksize); # with defaults
$dst = sqrBoxFilter($src,$ddepth,$ksize,$anchor,$normalize,$borderType);
For every pixel (x, y)
in the source image, the function calculates the sum of squares of those neighboring pixel values which overlap the filter placed over the pixel (x, y)
. The unnormalized square box filter can be useful in computing local image statistics such as the the local variance and standard deviation around the neighborhood of a pixel.
Parameters:
- src
-
input image
- dst
-
output image of the same size and type as src
- ddepth
-
the output image depth (-1 to use src.depth())
- ksize
-
kernel size
- anchor
-
kernel anchor point. The default value of Point(-1, -1) denotes that the anchor is at the kernel center.
- normalize
-
flag, specifying whether the kernel is to be normalized by it's area or not.
- borderType
-
border mode used to extrapolate pixels outside of the image, see #BorderTypes. #BORDER_WRAP is not supported.
See also: boxFilter
sqrBoxFilter ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
blur
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); indx [phys] ksize(n3=2); indx [phys] anchor(n4=2); int [phys] borderType())
Blurs an image using the normalized box filter. NO BROADCASTING.
$dst = blur($src,$ksize); # with defaults
$dst = blur($src,$ksize,$anchor,$borderType);
The function smooths an image using the kernel: \f[\texttt{K} = \frac{1}{\texttt{ksize.width*ksize.height}} \begin{bmatrix} 1 & 1 & 1 & \cdots & 1 & 1 \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \hdotsfor{6} \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \end{bmatrix}\f] The call `blur(src, dst, ksize, anchor, borderType)` is equivalent to `boxFilter(src, dst, src.type(), ksize, anchor, true, borderType)`.
Parameters:
- src
-
input image; it can have any number of channels, which are processed independently, but the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
- dst
-
output image of the same size and type as src.
- ksize
-
blurring kernel size.
- anchor
-
anchor point; default value Point(-1,-1) means that the anchor is at the kernel center.
- borderType
-
border mode used to extrapolate pixels outside of the image, see #BorderTypes. #BORDER_WRAP is not supported.
See also: boxFilter, bilateralFilter, GaussianBlur, medianBlur
blur ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
filter2D
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); int [phys] ddepth(); [phys] kernel(l4,c4,r4); indx [phys] anchor(n5=2); double [phys] delta(); int [phys] borderType())
Convolves an image with the kernel. NO BROADCASTING.
$dst = filter2D($src,$ddepth,$kernel); # with defaults
$dst = filter2D($src,$ddepth,$kernel,$anchor,$delta,$borderType);
The function applies an arbitrary linear filter to an image. In-place operation is supported. When the aperture is partially outside the image, the function interpolates outlier pixel values according to the specified border mode. The function does actually compute correlation, not the convolution: \f[\texttt{dst} (x,y) = \sum _{ \substack{0\leq x' < \texttt{kernel.cols}\\{0\leq y' < \texttt{kernel.rows}}}} \texttt{kernel} (x',y')* \texttt{src} (x+x'- \texttt{anchor.x} ,y+y'- \texttt{anchor.y} )\f] That is, the kernel is not mirrored around the anchor point. If you need a real convolution, flip the kernel using #flip and set the new anchor to `(kernel.cols - anchor.x - 1, kernel.rows - anchor.y - 1)`. The function uses the DFT-based algorithm in case of sufficiently large kernels (~`11 x 11` or larger) and the direct algorithm for small kernels. @ref filter_depths "combinations"
Parameters:
- src
-
input image.
- dst
-
output image of the same size and the same number of channels as src.
- ddepth
-
desired depth of the destination image, see
- kernel
-
convolution kernel (or rather a correlation kernel), a single-channel floating point matrix; if you want to apply different kernels to different channels, split the image into separate color planes using split and process them individually.
- anchor
-
anchor of the kernel that indicates the relative position of a filtered point within the kernel; the anchor should lie within the kernel; default value (-1,-1) means that the anchor is at the kernel center.
- delta
-
optional value added to the filtered pixels before storing them in dst.
- borderType
-
pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
See also: sepFilter2D, dft, matchTemplate
filter2D ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
sepFilter2D
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); int [phys] ddepth(); [phys] kernelX(l4,c4,r4); [phys] kernelY(l5,c5,r5); indx [phys] anchor(n6=2); double [phys] delta(); int [phys] borderType())
Applies a separable linear filter to an image. NO BROADCASTING.
$dst = sepFilter2D($src,$ddepth,$kernelX,$kernelY); # with defaults
$dst = sepFilter2D($src,$ddepth,$kernelX,$kernelY,$anchor,$delta,$borderType);
The function applies a separable linear filter to the image. That is, first, every row of src is filtered with the 1D kernel kernelX. Then, every column of the result is filtered with the 1D kernel kernelY. The final result shifted by delta is stored in dst . @ref filter_depths "combinations" (-1,-1)
means that the anchor is at the kernel center.
Parameters:
- src
-
Source image.
- dst
-
Destination image of the same size and the same number of channels as src .
- ddepth
-
Destination image depth, see
- kernelX
-
Coefficients for filtering each row.
- kernelY
-
Coefficients for filtering each column.
- anchor
-
Anchor position within the kernel. The default value
- delta
-
Value added to the filtered results before storing them.
- borderType
-
Pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
See also: filter2D, Sobel, GaussianBlur, boxFilter, blur
sepFilter2D ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
Sobel
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); int [phys] ddepth(); int [phys] dx(); int [phys] dy(); int [phys] ksize(); double [phys] scale(); double [phys] delta(); int [phys] borderType())
Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator. NO BROADCASTING.
$dst = Sobel($src,$ddepth,$dx,$dy); # with defaults
$dst = Sobel($src,$ddepth,$dx,$dy,$ksize,$scale,$delta,$borderType);
In all cases except one, the \texttt{ksize} \times \texttt{ksize}
separable kernel is used to calculate the derivative. When \texttt{ksize = 1}
, the 3 \times 1
or 1 \times 3
kernel is used (that is, no Gaussian smoothing is done). `ksize = 1` can only be used for the first or the second x- or y- derivatives. There is also the special value `ksize = #FILTER_SCHARR (-1)` that corresponds to the 3\times3
Scharr filter that may give more accurate results than the 3\times3
Sobel. The Scharr aperture is \f[\vecthreethree{-3}{0}{3}{-10}{0}{10}{-3}{0}{3}\f] for the x-derivative, or transposed for the y-derivative. The function calculates an image derivative by convolving the image with the appropriate kernel: \f[\texttt{dst} = \frac{\partial^{xorder+yorder} \texttt{src}}{\partial x^{xorder} \partial y^{yorder}}\f] The Sobel operators combine Gaussian smoothing and differentiation, so the result is more or less resistant to the noise. Most often, the function is called with ( xorder = 1, yorder = 0, ksize = 3) or ( xorder = 0, yorder = 1, ksize = 3) to calculate the first x- or y- image derivative. The first case corresponds to a kernel of: \f[\vecthreethree{-1}{0}{1}{-2}{0}{2}{-1}{0}{1}\f] The second case corresponds to a kernel of: \f[\vecthreethree{-1}{-2}{-1}{0}{0}{0}{1}{2}{1}\f] @ref filter_depths "combinations"; in the case of 8-bit input images it will result in truncated derivatives.
Parameters:
- src
-
input image.
- dst
-
output image of the same size and the same number of channels as src .
- ddepth
-
output image depth, see
- dx
-
order of the derivative x.
- dy
-
order of the derivative y.
- ksize
-
size of the extended Sobel kernel; it must be 1, 3, 5, or 7.
- scale
-
optional scale factor for the computed derivative values; by default, no scaling is applied (see #getDerivKernels for details).
- delta
-
optional delta value that is added to the results prior to storing them in dst.
- borderType
-
pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
See also: Scharr, Laplacian, sepFilter2D, filter2D, GaussianBlur, cartToPolar
Sobel ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
spatialGradient
Signature: ([phys] src(l1,c1,r1); [o,phys] dx(l2,c2,r2); [o,phys] dy(l3,c3,r3); int [phys] ksize(); int [phys] borderType())
Calculates the first order image derivative in both x and y using a Sobel operator NO BROADCASTING.
($dx,$dy) = spatialGradient($src); # with defaults
($dx,$dy) = spatialGradient($src,$ksize,$borderType);
Equivalent to calling:
Sobel( src, dx, CV_16SC1, 1, 0, 3 );
Sobel( src, dy, CV_16SC1, 0, 1, 3 );
Parameters:
- src
-
input image.
- dx
-
output image with first-order derivative in x.
- dy
-
output image with first-order derivative in y.
- ksize
-
size of Sobel kernel. It must be 3.
- borderType
-
pixel extrapolation method, see #BorderTypes. Only #BORDER_DEFAULT=#BORDER_REFLECT_101 and #BORDER_REPLICATE are supported.
See also: Sobel
spatialGradient ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
Scharr
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); int [phys] ddepth(); int [phys] dx(); int [phys] dy(); double [phys] scale(); double [phys] delta(); int [phys] borderType())
Calculates the first x- or y- image derivative using Scharr operator. NO BROADCASTING.
$dst = Scharr($src,$ddepth,$dx,$dy); # with defaults
$dst = Scharr($src,$ddepth,$dx,$dy,$scale,$delta,$borderType);
The function computes the first x- or y- spatial image derivative using the Scharr operator. The call \f[\texttt{Scharr(src, dst, ddepth, dx, dy, scale, delta, borderType)}\f] is equivalent to \f[\texttt{Sobel(src, dst, ddepth, dx, dy, FILTER_SCHARR, scale, delta, borderType)} .\f] @ref filter_depths "combinations"
Parameters:
- src
-
input image.
- dst
-
output image of the same size and the same number of channels as src.
- ddepth
-
output image depth, see
- dx
-
order of the derivative x.
- dy
-
order of the derivative y.
- scale
-
optional scale factor for the computed derivative values; by default, no scaling is applied (see #getDerivKernels for details).
- delta
-
optional delta value that is added to the results prior to storing them in dst.
- borderType
-
pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
See also: cartToPolar
Scharr ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
Laplacian
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); int [phys] ddepth(); int [phys] ksize(); double [phys] scale(); double [phys] delta(); int [phys] borderType())
Calculates the Laplacian of an image. NO BROADCASTING.
$dst = Laplacian($src,$ddepth); # with defaults
$dst = Laplacian($src,$ddepth,$ksize,$scale,$delta,$borderType);
The function calculates the Laplacian of the source image by adding up the second x and y derivatives calculated using the Sobel operator: \f[\texttt{dst} = \Delta \texttt{src} = \frac{\partial^2 \texttt{src}}{\partial x^2} + \frac{\partial^2 \texttt{src}}{\partial y^2}\f] This is done when `ksize > 1`. When `ksize == 1`, the Laplacian is computed by filtering the image with the following 3 \times 3
aperture: \f[\vecthreethree {0}{1}{0}{1}{-4}{1}{0}{1}{0}\f]
Parameters:
- src
-
Source image.
- dst
-
Destination image of the same size and the same number of channels as src .
- ddepth
-
Desired depth of the destination image.
- ksize
-
Aperture size used to compute the second-derivative filters. See #getDerivKernels for details. The size must be positive and odd.
- scale
-
Optional scale factor for the computed Laplacian values. By default, no scaling is applied. See #getDerivKernels for details.
- delta
-
Optional delta value that is added to the results prior to storing them in dst .
- borderType
-
Pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
See also: Sobel, Scharr
Laplacian ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
Canny
Signature: ([phys] image(l1,c1,r1); [o,phys] edges(l2,c2,r2); double [phys] threshold1(); double [phys] threshold2(); int [phys] apertureSize(); byte [phys] L2gradient())
Finds edges in an image using the Canny algorithm NO BROADCASTING.
$edges = Canny($image,$threshold1,$threshold2); # with defaults
$edges = Canny($image,$threshold1,$threshold2,$apertureSize,$L2gradient);
@cite Canny86 . The function finds edges in the input image and marks them in the output map edges using the Canny algorithm. The smallest value between threshold1 and threshold2 is used for edge linking. The largest value is used to find initial segments of strong edges. See <http://en.wikipedia.org/wiki/Canny_edge_detector> L_2
norm =\sqrt{(dI/dx)^2 + (dI/dy)^2}
should be used to calculate the image gradient magnitude ( L2gradient=true ), or whether the default L_1
norm =|dI/dx|+|dI/dy|
is enough ( L2gradient=false ).
Parameters:
- image
-
8-bit input image.
- edges
-
output edge map; single channels 8-bit image, which has the same size as image .
- threshold1
-
first threshold for the hysteresis procedure.
- threshold2
-
second threshold for the hysteresis procedure.
- apertureSize
-
aperture size for the Sobel operator.
- L2gradient
-
a flag, indicating whether a more accurate
Canny ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
Canny2
Signature: ([phys] dx(l1,c1,r1); [phys] dy(l2,c2,r2); [o,phys] edges(l3,c3,r3); double [phys] threshold1(); double [phys] threshold2(); byte [phys] L2gradient())
NO BROADCASTING.
$edges = Canny2($dx,$dy,$threshold1,$threshold2); # with defaults
$edges = Canny2($dx,$dy,$threshold1,$threshold2,$L2gradient);
\overload Finds edges in an image using the Canny algorithm with custom image gradient. L_2
norm =\sqrt{(dI/dx)^2 + (dI/dy)^2}
should be used to calculate the image gradient magnitude ( L2gradient=true ), or whether the default L_1
norm =|dI/dx|+|dI/dy|
is enough ( L2gradient=false ).
Parameters:
- dx
-
16-bit x derivative of input image (CV_16SC1 or CV_16SC3).
- dy
-
16-bit y derivative of input image (same type as dx).
- edges
-
output edge map; single channels 8-bit image, which has the same size as image .
- threshold1
-
first threshold for the hysteresis procedure.
- threshold2
-
second threshold for the hysteresis procedure.
- L2gradient
-
a flag, indicating whether a more accurate
Canny2 ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
cornerMinEigenVal
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); int [phys] blockSize(); int [phys] ksize(); int [phys] borderType())
Calculates the minimal eigenvalue of gradient matrices for corner detection. NO BROADCASTING.
$dst = cornerMinEigenVal($src,$blockSize); # with defaults
$dst = cornerMinEigenVal($src,$blockSize,$ksize,$borderType);
The function is similar to cornerEigenValsAndVecs but it calculates and stores only the minimal eigenvalue of the covariance matrix of derivatives, that is, \min(\lambda_1, \lambda_2)
in terms of the formulae in the cornerEigenValsAndVecs description.
Parameters:
- src
-
Input single-channel 8-bit or floating-point image.
- dst
-
Image to store the minimal eigenvalues. It has the type CV_32FC1 and the same size as src .
- blockSize
-
Neighborhood size (see the details on #cornerEigenValsAndVecs ).
- ksize
-
Aperture parameter for the Sobel operator.
- borderType
-
Pixel extrapolation method. See #BorderTypes. #BORDER_WRAP is not supported.
cornerMinEigenVal ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
cornerHarris
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); int [phys] blockSize(); int [phys] ksize(); double [phys] k(); int [phys] borderType())
Harris corner detector. NO BROADCASTING.
$dst = cornerHarris($src,$blockSize,$ksize,$k); # with defaults
$dst = cornerHarris($src,$blockSize,$ksize,$k,$borderType);
The function runs the Harris corner detector on the image. Similarly to cornerMinEigenVal and cornerEigenValsAndVecs , for each pixel (x, y)
it calculates a 2\times2
gradient covariance matrix M^{(x,y)}
over a \texttt{blockSize} \times \texttt{blockSize}
neighborhood. Then, it computes the following characteristic: \f[\texttt{dst} (x,y) = \mathrm{det} M^{(x,y)} - k \cdot \left ( \mathrm{tr} M^{(x,y)} \right )^2\f] Corners in the image can be found as the local maxima of this response map.
Parameters:
- src
-
Input single-channel 8-bit or floating-point image.
- dst
-
Image to store the Harris detector responses. It has the type CV_32FC1 and the same size as src .
- blockSize
-
Neighborhood size (see the details on #cornerEigenValsAndVecs ).
- ksize
-
Aperture parameter for the Sobel operator.
- k
-
Harris detector free parameter. See the formula above.
- borderType
-
Pixel extrapolation method. See #BorderTypes. #BORDER_WRAP is not supported.
cornerHarris ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
cornerEigenValsAndVecs
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); int [phys] blockSize(); int [phys] ksize(); int [phys] borderType())
Calculates eigenvalues and eigenvectors of image blocks for corner detection. NO BROADCASTING.
$dst = cornerEigenValsAndVecs($src,$blockSize,$ksize); # with defaults
$dst = cornerEigenValsAndVecs($src,$blockSize,$ksize,$borderType);
For every pixel p
, the function cornerEigenValsAndVecs considers a blockSize \times
blockSize neighborhood S(p)
. It calculates the covariation matrix of derivatives over the neighborhood as: \f[M = \begin{bmatrix} \sum _{S(p)}(dI/dx)^2 & \sum _{S(p)}dI/dx dI/dy \\ \sum _{S(p)}dI/dx dI/dy & \sum _{S(p)}(dI/dy)^2 \end{bmatrix}\f] where the derivatives are computed using the Sobel operator. After that, it finds eigenvectors and eigenvalues of M
and stores them in the destination image as (\lambda_1, \lambda_2, x_1, y_1, x_2, y_2)
where - \lambda_1, \lambda_2
are the non-sorted eigenvalues of M
- x_1, y_1
are the eigenvectors corresponding to \lambda_1
- x_2, y_2
are the eigenvectors corresponding to \lambda_2
The output of the function can be used for robust edge or corner detection.
Parameters:
- src
-
Input single-channel 8-bit or floating-point image.
- dst
-
Image to store the results. It has the same size as src and the type CV_32FC(6) .
- blockSize
-
Neighborhood size (see details below).
- ksize
-
Aperture parameter for the Sobel operator.
- borderType
-
Pixel extrapolation method. See #BorderTypes. #BORDER_WRAP is not supported.
See also: cornerMinEigenVal, cornerHarris, preCornerDetect
cornerEigenValsAndVecs ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
preCornerDetect
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); int [phys] ksize(); int [phys] borderType())
Calculates a feature map for corner detection. NO BROADCASTING.
$dst = preCornerDetect($src,$ksize); # with defaults
$dst = preCornerDetect($src,$ksize,$borderType);
The function calculates the complex spatial derivative-based function of the source image \f[\texttt{dst} = (D_x \texttt{src} )^2 \cdot D_{yy} \texttt{src} + (D_y \texttt{src} )^2 \cdot D_{xx} \texttt{src} - 2 D_x \texttt{src} \cdot D_y \texttt{src} \cdot D_{xy} \texttt{src}\f] where D_x
,D_y
are the first image derivatives, D_{xx}
,D_{yy}
are the second image derivatives, and D_{xy}
is the mixed derivative. The corners can be found as local maximums of the functions, as shown below:
Mat corners, dilated_corners;
preCornerDetect(image, corners, 3);
// dilation with 3x3 rectangular structuring element
dilate(corners, dilated_corners, Mat(), 1);
Mat corner_mask = corners == dilated_corners;
Parameters:
- src
-
Source single-channel 8-bit of floating-point image.
- dst
-
Output image that has the type CV_32F and the same size as src .
- ksize
-
%Aperture size of the Sobel .
- borderType
-
Pixel extrapolation method. See #BorderTypes. #BORDER_WRAP is not supported.
preCornerDetect ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
cornerSubPix
Signature: ([phys] image(l1,c1,r1); [io,phys] corners(l2,c2,r2); indx [phys] winSize(n3=2); indx [phys] zeroZone(n4=2); TermCriteriaWrapper * criteria)
Refines the corner locations.
cornerSubPix($image,$corners,$winSize,$zeroZone,$criteria);
The function iterates to find the sub-pixel accurate location of corners or radial saddle points as described in @cite forstner1987fast, and as shown on the figure below. ![image](pics/cornersubpix.png) Sub-pixel accurate corner locator is based on the observation that every vector from the center q
to a point p
located within a neighborhood of q
is orthogonal to the image gradient at p
subject to image and measurement noise. Consider the expression: \f[\epsilon _i = {DI_{p_i}}^T \cdot (q - p_i)\f] where {DI_{p_i}}
is an image gradient at one of the points p_i
in a neighborhood of q
. The value of q
is to be found so that \epsilon_i
is minimized. A system of equations may be set up with \epsilon_i
set to zero: \f[\sum _i(DI_{p_i} \cdot {DI_{p_i}}^T) \cdot q - \sum _i(DI_{p_i} \cdot {DI_{p_i}}^T \cdot p_i)\f] where the gradients are summed within a neighborhood ("search window") of q
. Calling the first gradient term G
and the second gradient term b
gives: \f[q = G^{-1} \cdot b\f] The algorithm sets the center of the neighborhood window at this new center q
and then iterates until the center stays within a set threshold. (5*2+1) \times (5*2+1) = 11 \times 11
search window is used.
Parameters:
- image
-
Input single-channel, 8-bit or float image.
- corners
-
Initial coordinates of the input corners and refined coordinates provided for output.
- winSize
-
Half of the side length of the search window. For example, if winSize=Size(5,5) , then a
- zeroZone
-
Half of the size of the dead region in the middle of the search zone over which the summation in the formula below is not done. It is used sometimes to avoid possible singularities of the autocorrelation matrix. The value of (-1,-1) indicates that there is no such a size.
- criteria
-
Criteria for termination of the iterative process of corner refinement. That is, the process of corner position refinement stops either after criteria.maxCount iterations or when the corner position moves by less than criteria.epsilon on some iteration.
cornerSubPix ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
goodFeaturesToTrack
Signature: ([phys] image(l1,c1,r1); [o,phys] corners(l2,c2,r2); int [phys] maxCorners(); double [phys] qualityLevel(); double [phys] minDistance(); [phys] mask(l6,c6,r6); int [phys] blockSize(); byte [phys] useHarrisDetector(); double [phys] k())
Determines strong corners on an image. NO BROADCASTING.
$corners = goodFeaturesToTrack($image,$maxCorners,$qualityLevel,$minDistance); # with defaults
$corners = goodFeaturesToTrack($image,$maxCorners,$qualityLevel,$minDistance,$mask,$blockSize,$useHarrisDetector,$k);
The function finds the most prominent corners in the image or in the specified image region, as described in @cite Shi94 - Function calculates the corner quality measure at every source image pixel using the #cornerMinEigenVal or #cornerHarris . - Function performs a non-maximum suppression (the local maximums in *3 x 3* neighborhood are retained). - The corners with the minimal eigenvalue less than \texttt{qualityLevel} \cdot \max_{x,y} qualityMeasureMap(x,y)
are rejected. - The remaining corners are sorted by the quality measure in the descending order. - Function throws away each corner for which there is a stronger corner at a distance less than maxDistance. The function can be used to initialize a point-based tracker of an object. @note If the function is called with different values A and B of the parameter qualityLevel , and A \> B, the vector of returned corners with qualityLevel=A will be the prefix of the output vector with qualityLevel=B .
Parameters:
- image
-
Input 8-bit or floating-point 32-bit, single-channel image.
- corners
-
Output vector of detected corners.
- maxCorners
-
Maximum number of corners to return. If there are more corners than are found, the strongest of them is returned. `maxCorners <= 0` implies that no limit on the maximum is set and all detected corners are returned.
- qualityLevel
-
Parameter characterizing the minimal accepted quality of image corners. The parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue (see #cornerMinEigenVal ) or the Harris function response (see #cornerHarris ). The corners with the quality measure less than the product are rejected. For example, if the best corner has the quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure less than 15 are rejected.
- minDistance
-
Minimum possible Euclidean distance between the returned corners.
- mask
-
Optional region of interest. If the image is not empty (it needs to have the type CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.
- blockSize
-
Size of an average block for computing a derivative covariation matrix over each pixel neighborhood. See cornerEigenValsAndVecs .
- useHarrisDetector
-
Parameter indicating whether to use a Harris detector (see #cornerHarris) or #cornerMinEigenVal.
- k
-
Free parameter of the Harris detector.
See also: cornerMinEigenVal, cornerHarris, calcOpticalFlowPyrLK, estimateRigidTransform,
goodFeaturesToTrack ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
goodFeaturesToTrack2
Signature: ([phys] image(l1,c1,r1); [o,phys] corners(l2,c2,r2); int [phys] maxCorners(); double [phys] qualityLevel(); double [phys] minDistance(); [phys] mask(l6,c6,r6); int [phys] blockSize(); int [phys] gradientSize(); byte [phys] useHarrisDetector(); double [phys] k())
NO BROADCASTING.
$corners = goodFeaturesToTrack2($image,$maxCorners,$qualityLevel,$minDistance,$mask,$blockSize,$gradientSize); # with defaults
$corners = goodFeaturesToTrack2($image,$maxCorners,$qualityLevel,$minDistance,$mask,$blockSize,$gradientSize,$useHarrisDetector,$k);
goodFeaturesToTrack2 ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
goodFeaturesToTrackWithQuality
Signature: ([phys] image(l1,c1,r1); [o,phys] corners(l2,c2,r2); int [phys] maxCorners(); double [phys] qualityLevel(); double [phys] minDistance(); [phys] mask(l6,c6,r6); [o,phys] cornersQuality(l7,c7,r7); int [phys] blockSize(); int [phys] gradientSize(); byte [phys] useHarrisDetector(); double [phys] k())
Same as above, but returns also quality measure of the detected corners. NO BROADCASTING.
($corners,$cornersQuality) = goodFeaturesToTrackWithQuality($image,$maxCorners,$qualityLevel,$minDistance,$mask); # with defaults
($corners,$cornersQuality) = goodFeaturesToTrackWithQuality($image,$maxCorners,$qualityLevel,$minDistance,$mask,$blockSize,$gradientSize,$useHarrisDetector,$k);
Parameters:
- image
-
Input 8-bit or floating-point 32-bit, single-channel image.
- corners
-
Output vector of detected corners.
- maxCorners
-
Maximum number of corners to return. If there are more corners than are found, the strongest of them is returned. `maxCorners <= 0` implies that no limit on the maximum is set and all detected corners are returned.
- qualityLevel
-
Parameter characterizing the minimal accepted quality of image corners. The parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue (see #cornerMinEigenVal ) or the Harris function response (see #cornerHarris ). The corners with the quality measure less than the product are rejected. For example, if the best corner has the quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure less than 15 are rejected.
- minDistance
-
Minimum possible Euclidean distance between the returned corners.
- mask
-
Region of interest. If the image is not empty (it needs to have the type CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.
- cornersQuality
-
Output vector of quality measure of the detected corners.
- blockSize
-
Size of an average block for computing a derivative covariation matrix over each pixel neighborhood. See cornerEigenValsAndVecs .
- gradientSize
-
Aperture parameter for the Sobel operator used for derivatives computation. See cornerEigenValsAndVecs .
- useHarrisDetector
-
Parameter indicating whether to use a Harris detector (see #cornerHarris) or #cornerMinEigenVal.
- k
-
Free parameter of the Harris detector.
goodFeaturesToTrackWithQuality ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
HoughLines
Signature: ([phys] image(l1,c1,r1); [o,phys] lines(l2,c2,r2); double [phys] rho(); double [phys] theta(); int [phys] threshold(); double [phys] srn(); double [phys] stn(); double [phys] min_theta(); double [phys] max_theta())
Finds lines in a binary image using the standard Hough transform. NO BROADCASTING.
$lines = HoughLines($image,$rho,$theta,$threshold); # with defaults
$lines = HoughLines($image,$rho,$theta,$threshold,$srn,$stn,$min_theta,$max_theta);
The function implements the standard or standard multi-scale Hough transform algorithm for line detection. See <http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm> for a good explanation of Hough transform. (\rho, \theta)
or (\rho, \theta, \textrm{votes})
. \rho
is the distance from the coordinate origin (0,0)
(top-left corner of the image). \theta
is the line rotation angle in radians ( 0 \sim \textrm{vertical line}, \pi/2 \sim \textrm{horizontal line}
). \textrm{votes}
is the value of accumulator. >\texttt{threshold}
).
Parameters:
- image
-
8-bit, single-channel binary source image. The image may be modified by the function.
- lines
-
Output vector of lines. Each line is represented by a 2 or 3 element vector
- rho
-
Distance resolution of the accumulator in pixels.
- theta
-
Angle resolution of the accumulator in radians.
- threshold
-
Accumulator threshold parameter. Only those lines are returned that get enough votes (
- srn
-
For the multi-scale Hough transform, it is a divisor for the distance resolution rho . The coarse accumulator distance resolution is rho and the accurate accumulator resolution is rho/srn . If both srn=0 and stn=0 , the classical Hough transform is used. Otherwise, both these parameters should be positive.
- stn
-
For the multi-scale Hough transform, it is a divisor for the distance resolution theta.
- min_theta
-
For standard and multi-scale Hough transform, minimum angle to check for lines. Must fall between 0 and max_theta.
- max_theta
-
For standard and multi-scale Hough transform, maximum angle to check for lines. Must fall between min_theta and CV_PI.
HoughLines ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
HoughLinesP
Signature: ([phys] image(l1,c1,r1); [o,phys] lines(l2,c2,r2); double [phys] rho(); double [phys] theta(); int [phys] threshold(); double [phys] minLineLength(); double [phys] maxLineGap())
Finds line segments in a binary image using the probabilistic Hough transform. NO BROADCASTING.
$lines = HoughLinesP($image,$rho,$theta,$threshold); # with defaults
$lines = HoughLinesP($image,$rho,$theta,$threshold,$minLineLength,$maxLineGap);
The function implements the probabilistic Hough transform algorithm for line detection, described in @cite Matas00 See the line detection example below: @include snippets/imgproc_HoughLinesP.cpp This is a sample picture the function parameters have been tuned for: ![image](pics/building.jpg) And this is the output of the above program in case of the probabilistic Hough transform: ![image](pics/houghp.png) (x_1, y_1, x_2, y_2)
, where (x_1,y_1)
and (x_2, y_2)
are the ending points of each detected line segment. >\texttt{threshold}
).
Parameters:
- image
-
8-bit, single-channel binary source image. The image may be modified by the function.
- lines
-
Output vector of lines. Each line is represented by a 4-element vector
- rho
-
Distance resolution of the accumulator in pixels.
- theta
-
Angle resolution of the accumulator in radians.
- threshold
-
Accumulator threshold parameter. Only those lines are returned that get enough votes (
- minLineLength
-
Minimum line length. Line segments shorter than that are rejected.
- maxLineGap
-
Maximum allowed gap between points on the same line to link them.
See also: LineSegmentDetector
HoughLinesP ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
HoughLinesPointSet
Signature: ([phys] point(l1,c1,r1); [o,phys] lines(l2,c2,r2); int [phys] lines_max(); int [phys] threshold(); double [phys] min_rho(); double [phys] max_rho(); double [phys] rho_step(); double [phys] min_theta(); double [phys] max_theta(); double [phys] theta_step())
Finds lines in a set of points using the standard Hough transform. NO BROADCASTING.
$lines = HoughLinesPointSet($point,$lines_max,$threshold,$min_rho,$max_rho,$rho_step,$min_theta,$max_theta,$theta_step);
The function finds lines in a set of points using a modification of the Hough transform. @include snippets/imgproc_HoughLinesPointSet.cpp (x,y)
. Type must be CV_32FC2 or CV_32SC2. (votes, rho, theta)
. The larger the value of 'votes', the higher the reliability of the Hough line. >\texttt{threshold}
)
Parameters:
- point
-
Input vector of points. Each vector must be encoded as a Point vector
- lines
-
Output vector of found lines. Each vector is encoded as a vector<Vec3d>
- lines_max
-
Max count of hough lines.
- threshold
-
Accumulator threshold parameter. Only those lines are returned that get enough votes (
- min_rho
-
Minimum Distance value of the accumulator in pixels.
- max_rho
-
Maximum Distance value of the accumulator in pixels.
- rho_step
-
Distance resolution of the accumulator in pixels.
- min_theta
-
Minimum angle value of the accumulator in radians.
- max_theta
-
Maximum angle value of the accumulator in radians.
- theta_step
-
Angle resolution of the accumulator in radians.
HoughLinesPointSet ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
HoughCircles
Signature: ([phys] image(l1,c1,r1); [o,phys] circles(l2,c2,r2); int [phys] method(); double [phys] dp(); double [phys] minDist(); double [phys] param1(); double [phys] param2(); int [phys] minRadius(); int [phys] maxRadius())
Finds circles in a grayscale image using the Hough transform. NO BROADCASTING.
$circles = HoughCircles($image,$method,$dp,$minDist); # with defaults
$circles = HoughCircles($image,$method,$dp,$minDist,$param1,$param2,$minRadius,$maxRadius);
The function finds circles in a grayscale image using a modification of the Hough transform. Example: : @include snippets/imgproc_HoughLinesCircles.cpp @note Usually the function detects the centers of circles well. However, it may fail to find correct radii. You can assist to the function by specifying the radius range ( minRadius and maxRadius ) if you know it. Or, in the case of #HOUGH_GRADIENT method you may set maxRadius to a negative number to return centers only without radius search, and find the correct radius using an additional procedure. It also helps to smooth image a bit unless it's already soft. For example, GaussianBlur() with 7x7 kernel and 1.5x1.5 sigma or similar blurring may help. (x, y, radius)
or (x, y, radius, votes)
.
Parameters:
- image
-
8-bit, single-channel, grayscale input image.
- circles
-
Output vector of found circles. Each vector is encoded as 3 or 4 element floating-point vector
- method
-
Detection method, see #HoughModes. The available methods are #HOUGH_GRADIENT and #HOUGH_GRADIENT_ALT.
- dp
-
Inverse ratio of the accumulator resolution to the image resolution. For example, if dp=1 , the accumulator has the same resolution as the input image. If dp=2 , the accumulator has half as big width and height. For #HOUGH_GRADIENT_ALT the recommended value is dp=1.5, unless some small very circles need to be detected.
- minDist
-
Minimum distance between the centers of the detected circles. If the parameter is too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is too large, some circles may be missed.
- param1
-
First method-specific parameter. In case of #HOUGH_GRADIENT and #HOUGH_GRADIENT_ALT, it is the higher threshold of the two passed to the Canny edge detector (the lower one is twice smaller). Note that #HOUGH_GRADIENT_ALT uses #Scharr algorithm to compute image derivatives, so the threshold value shough normally be higher, such as 300 or normally exposed and contrasty images.
- param2
-
Second method-specific parameter. In case of #HOUGH_GRADIENT, it is the accumulator threshold for the circle centers at the detection stage. The smaller it is, the more false circles may be detected. Circles, corresponding to the larger accumulator values, will be returned first. In the case of #HOUGH_GRADIENT_ALT algorithm, this is the circle "perfectness" measure. The closer it to 1, the better shaped circles algorithm selects. In most cases 0.9 should be fine. If you want get better detection of small circles, you may decrease it to 0.85, 0.8 or even less. But then also try to limit the search range [minRadius, maxRadius] to avoid many false circles.
- minRadius
-
Minimum circle radius.
- maxRadius
-
Maximum circle radius. If <= 0, uses the maximum image dimension. If < 0, #HOUGH_GRADIENT returns centers without finding the radius. #HOUGH_GRADIENT_ALT always computes circle radiuses.
See also: fitEllipse, minEnclosingCircle
HoughCircles ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
erode
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); [phys] kernel(l3,c3,r3); indx [phys] anchor(n4=2); int [phys] iterations(); int [phys] borderType(); double [phys] borderValue(n7=4))
Erodes an image by using a specific structuring element. NO BROADCASTING.
$dst = erode($src,$kernel); # with defaults
$dst = erode($src,$kernel,$anchor,$iterations,$borderType,$borderValue);
The function erodes the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the minimum is taken: \f[\texttt{dst} (x,y) = \min _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\f] The function supports the in-place mode. Erosion can be applied several ( iterations ) times. In case of multi-channel images, each channel is processed independently.
Parameters:
- src
-
input image; the number of channels can be arbitrary, but the depth should be one of CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
- dst
-
output image of the same size and type as src.
- kernel
-
structuring element used for erosion; if `element=Mat()`, a `3 x 3` rectangular structuring element is used. Kernel can be created using #getStructuringElement.
- anchor
-
position of the anchor within the element; default value (-1, -1) means that the anchor is at the element center.
- iterations
-
number of times erosion is applied.
- borderType
-
pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
- borderValue
-
border value in case of a constant border
See also: dilate, morphologyEx, getStructuringElement
erode ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
dilate
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); [phys] kernel(l3,c3,r3); indx [phys] anchor(n4=2); int [phys] iterations(); int [phys] borderType(); double [phys] borderValue(n7=4))
Dilates an image by using a specific structuring element. NO BROADCASTING.
$dst = dilate($src,$kernel); # with defaults
$dst = dilate($src,$kernel,$anchor,$iterations,$borderType,$borderValue);
The function dilates the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the maximum is taken: \f[\texttt{dst} (x,y) = \max _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\f] The function supports the in-place mode. Dilation can be applied several ( iterations ) times. In case of multi-channel images, each channel is processed independently.
Parameters:
- src
-
input image; the number of channels can be arbitrary, but the depth should be one of CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
- dst
-
output image of the same size and type as src.
- kernel
-
structuring element used for dilation; if elemenat=Mat(), a 3 x 3 rectangular structuring element is used. Kernel can be created using #getStructuringElement
- anchor
-
position of the anchor within the element; default value (-1, -1) means that the anchor is at the element center.
- iterations
-
number of times dilation is applied.
- borderType
-
pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not suported.
- borderValue
-
border value in case of a constant border
See also: erode, morphologyEx, getStructuringElement
dilate ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
morphologyEx
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); int [phys] op(); [phys] kernel(l4,c4,r4); indx [phys] anchor(n5=2); int [phys] iterations(); int [phys] borderType(); double [phys] borderValue(n8=4))
Performs advanced morphological transformations. NO BROADCASTING.
$dst = morphologyEx($src,$op,$kernel); # with defaults
$dst = morphologyEx($src,$op,$kernel,$anchor,$iterations,$borderType,$borderValue);
The function cv::morphologyEx can perform advanced morphological transformations using an erosion and dilation as basic operations. Any of the operations can be done in-place. In case of multi-channel images, each channel is processed independently. @note The number of iterations is the number of times erosion or dilatation operation will be applied. For instance, an opening operation (#MORPH_OPEN) with two iterations is equivalent to apply successively: erode -> erode -> dilate -> dilate (and not erode -> dilate -> erode -> dilate).
Parameters:
- src
-
Source image. The number of channels can be arbitrary. The depth should be one of CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
- dst
-
Destination image of the same size and type as source image.
- op
-
Type of a morphological operation, see #MorphTypes
- kernel
-
Structuring element. It can be created using #getStructuringElement.
- anchor
-
Anchor position with the kernel. Negative values mean that the anchor is at the kernel center.
- iterations
-
Number of times erosion and dilation are applied.
- borderType
-
Pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
- borderValue
-
Border value in case of a constant border. The default value has a special meaning.
See also: dilate, erode, getStructuringElement
morphologyEx ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
resize
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); indx [phys] dsize(n3=2); double [phys] fx(); double [phys] fy(); int [phys] interpolation())
Resizes an image. NO BROADCASTING.
$dst = resize($src,$dsize); # with defaults
$dst = resize($src,$dsize,$fx,$fy,$interpolation);
The function resize resizes the image src down to or up to the specified size. Note that the initial dst type or size are not taken into account. Instead, the size and type are derived from the `src`,`dsize`,`fx`, and `fy`. If you want to resize src so that it fits the pre-created dst, you may call the function as follows:
// explicitly specify dsize=dst.size(); fx and fy will be computed from that.
resize(src, dst, dst.size(), 0, 0, interpolation);
If you want to decimate the image by factor of 2 in each direction, you can call the function this way:
// specify fx and fy and let the function compute the destination image size.
resize(src, dst, Size(), 0.5, 0.5, interpolation);
To shrink an image, it will generally look best with #INTER_AREA interpolation, whereas to enlarge an image, it will generally look best with c#INTER_CUBIC (slow) or #INTER_LINEAR (faster but still looks OK). \f[\texttt{dsize = Size(round(fx*src.cols), round(fy*src.rows))}\f] Either dsize or both fx and fy must be non-zero. \f[\texttt{(double)dsize.width/src.cols}\f] \f[\texttt{(double)dsize.height/src.rows}\f]
Parameters:
- src
-
input image.
- dst
-
output image; it has the size dsize (when it is non-zero) or the size computed from src.size(), fx, and fy; the type of dst is the same as of src.
- dsize
-
output image size; if it equals zero (`None` in Python), it is computed as:
- fx
-
scale factor along the horizontal axis; when it equals 0, it is computed as
- fy
-
scale factor along the vertical axis; when it equals 0, it is computed as
- interpolation
-
interpolation method, see #InterpolationFlags
See also: warpAffine, warpPerspective, remap
resize ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
warpAffine
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); [phys] M(l3,c3,r3); indx [phys] dsize(n4=2); int [phys] flags(); int [phys] borderMode(); double [phys] borderValue(n7))
Applies an affine transformation to an image. NO BROADCASTING.
$dst = warpAffine($src,$M,$dsize); # with defaults
$dst = warpAffine($src,$M,$dsize,$flags,$borderMode,$borderValue);
The function warpAffine transforms the source image using the specified matrix: \f[\texttt{dst} (x,y) = \texttt{src} ( \texttt{M} _{11} x + \texttt{M} _{12} y + \texttt{M} _{13}, \texttt{M} _{21} x + \texttt{M} _{22} y + \texttt{M} _{23})\f] when the flag #WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted with #invertAffineTransform and then put in the formula above instead of M. The function cannot operate in-place. 2\times 3
transformation matrix. \texttt{dst}\rightarrow\texttt{src}
).
Parameters:
- src
-
input image.
- dst
-
output image that has the size dsize and the same type as src .
- M
- dsize
-
size of the output image.
- flags
-
combination of interpolation methods (see #InterpolationFlags) and the optional flag #WARP_INVERSE_MAP that means that M is the inverse transformation (
- borderMode
-
pixel extrapolation method (see #BorderTypes); when borderMode=#BORDER_TRANSPARENT, it means that the pixels in the destination image corresponding to the "outliers" in the source image are not modified by the function.
- borderValue
-
value used in case of a constant border; by default, it is 0.
See also: warpPerspective, resize, remap, getRectSubPix, transform
warpAffine ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
warpPerspective
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); [phys] M(l3,c3,r3); indx [phys] dsize(n4=2); int [phys] flags(); int [phys] borderMode(); double [phys] borderValue(n7))
Applies a perspective transformation to an image. NO BROADCASTING.
$dst = warpPerspective($src,$M,$dsize); # with defaults
$dst = warpPerspective($src,$M,$dsize,$flags,$borderMode,$borderValue);
The function warpPerspective transforms the source image using the specified matrix: \f[\texttt{dst} (x,y) = \texttt{src} \left ( \frac{M_{11} x + M_{12} y + M_{13}}{M_{31} x + M_{32} y + M_{33}} , \frac{M_{21} x + M_{22} y + M_{23}}{M_{31} x + M_{32} y + M_{33}} \right )\f] when the flag #WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted with invert and then put in the formula above instead of M. The function cannot operate in-place. 3\times 3
transformation matrix. \texttt{dst}\rightarrow\texttt{src}
).
Parameters:
- src
-
input image.
- dst
-
output image that has the size dsize and the same type as src .
- M
- dsize
-
size of the output image.
- flags
-
combination of interpolation methods (#INTER_LINEAR or #INTER_NEAREST) and the optional flag #WARP_INVERSE_MAP, that sets M as the inverse transformation (
- borderMode
-
pixel extrapolation method (#BORDER_CONSTANT or #BORDER_REPLICATE).
- borderValue
-
value used in case of a constant border; by default, it equals 0.
See also: warpAffine, resize, remap, getRectSubPix, perspectiveTransform
warpPerspective ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
remap
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); [phys] map1(l3,c3,r3); [phys] map2(l4,c4,r4); int [phys] interpolation(); int [phys] borderMode(); double [phys] borderValue(n7))
Applies a generic geometrical transformation to an image. NO BROADCASTING.
$dst = remap($src,$map1,$map2,$interpolation); # with defaults
$dst = remap($src,$map1,$map2,$interpolation,$borderMode,$borderValue);
The function remap transforms the source image using the specified map: \f[\texttt{dst} (x,y) = \texttt{src} (map_x(x,y),map_y(x,y))\f] where values of pixels with non-integer coordinates are computed using one of available interpolation methods. map_x
and map_y
can be encoded as separate floating-point maps in map_1
and map_2
respectively, or interleaved floating-point maps of (x,y)
in map_1
, or fixed-point maps created by using convertMaps. The reason you might want to convert from floating to fixed-point representations of a map is that they can yield much faster (\~2x) remapping operations. In the converted case, map_1
contains pairs (cvFloor(x), cvFloor(y)) and map_2
contains indices in a table of interpolation coefficients. This function cannot operate in-place. @note Due to current implementation limitations the size of an input and output images should be less than 32767x32767.
Parameters:
- src
-
Source image.
- dst
-
Destination image. It has the same size as map1 and the same type as src .
- map1
-
The first map of either (x,y) points or just x values having the type CV_16SC2 , CV_32FC1, or CV_32FC2. See convertMaps for details on converting a floating point representation to fixed-point for speed.
- map2
-
The second map of y values having the type CV_16UC1, CV_32FC1, or none (empty map if map1 is (x,y) points), respectively.
- interpolation
-
Interpolation method (see #InterpolationFlags). The methods #INTER_AREA and #INTER_LINEAR_EXACT are not supported by this function.
- borderMode
-
Pixel extrapolation method (see #BorderTypes). When borderMode=#BORDER_TRANSPARENT, it means that the pixels in the destination image that corresponds to the "outliers" in the source image are not modified by the function.
- borderValue
-
Value used in case of a constant border. By default, it is 0.
remap ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
convertMaps
Signature: ([phys] map1(l1,c1,r1); [phys] map2(l2,c2,r2); [o,phys] dstmap1(l3,c3,r3); [o,phys] dstmap2(l4,c4,r4); int [phys] dstmap1type(); byte [phys] nninterpolation())
Converts image transformation maps from one representation to another. NO BROADCASTING.
($dstmap1,$dstmap2) = convertMaps($map1,$map2,$dstmap1type); # with defaults
($dstmap1,$dstmap2) = convertMaps($map1,$map2,$dstmap1type,$nninterpolation);
The function converts a pair of maps for remap from one representation to another. The following options ( (map1.type(), map2.type()) \rightarrow
(dstmap1.type(), dstmap2.type()) ) are supported: - \texttt{(CV_32FC1, CV_32FC1)} \rightarrow \texttt{(CV_16SC2, CV_16UC1)}
. This is the most frequently used conversion operation, in which the original floating-point maps (see remap ) are converted to a more compact and much faster fixed-point representation. The first output array contains the rounded coordinates and the second array (created only when nninterpolation=false ) contains indices in the interpolation tables. - \texttt{(CV_32FC2)} \rightarrow \texttt{(CV_16SC2, CV_16UC1)}
. The same as above but the original maps are stored in one 2-channel matrix. - Reverse conversion. Obviously, the reconstructed floating-point maps will not be exactly the same as the originals.
Parameters:
- map1
-
The first input map of type CV_16SC2, CV_32FC1, or CV_32FC2 .
- map2
-
The second input map of type CV_16UC1, CV_32FC1, or none (empty matrix), respectively.
- dstmap1
-
The first output map that has the type dstmap1type and the same size as src .
- dstmap2
-
The second output map.
- dstmap1type
-
Type of the first output map that should be CV_16SC2, CV_32FC1, or CV_32FC2 .
- nninterpolation
-
Flag indicating whether the fixed-point maps are used for the nearest-neighbor or for a more complex interpolation.
See also: remap, undistort, initUndistortRectifyMap
convertMaps ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
getRotationMatrix2D
Signature: (float [phys] center(n1=2); double [phys] angle(); double [phys] scale(); [o,phys] res(l4,c4,r4))
Calculates an affine matrix of 2D rotation. NO BROADCASTING.
$res = getRotationMatrix2D($center,$angle,$scale);
The function calculates the following matrix: \f[\begin{bmatrix} \alpha & \beta & (1- \alpha ) \cdot \texttt{center.x} - \beta \cdot \texttt{center.y} \\ - \beta & \alpha & \beta \cdot \texttt{center.x} + (1- \alpha ) \cdot \texttt{center.y} \end{bmatrix}\f] where \f[\begin{array}{l} \alpha = \texttt{scale} \cdot \cos \texttt{angle} , \\ \beta = \texttt{scale} \cdot \sin \texttt{angle} \end{array}\f] The transformation maps the rotation center to itself. If this is not the target, adjust the shift.
Parameters:
- center
-
Center of the rotation in the source image.
- angle
-
Rotation angle in degrees. Positive values mean counter-clockwise rotation (the coordinate origin is assumed to be the top-left corner).
- scale
-
Isotropic scale factor.
See also: getAffineTransform, warpAffine, transform
getRotationMatrix2D ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
invertAffineTransform
Signature: ([phys] M(l1,c1,r1); [o,phys] iM(l2,c2,r2))
Inverts an affine transformation. NO BROADCASTING.
$iM = invertAffineTransform($M);
The function computes an inverse affine transformation represented by 2 \times 3
matrix M: \f[\begin{bmatrix} a_{11} & a_{12} & b_1 \\ a_{21} & a_{22} & b_2 \end{bmatrix}\f] The result is also a 2 \times 3
matrix of the same type as M.
Parameters:
- M
-
Original affine transformation.
- iM
-
Output reverse affine transformation.
invertAffineTransform ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
getPerspectiveTransform
Signature: ([phys] src(l1,c1,r1); [phys] dst(l2,c2,r2); int [phys] solveMethod(); [o,phys] res(l4,c4,r4))
Calculates a perspective transform from four pairs of the corresponding points. NO BROADCASTING.
$res = getPerspectiveTransform($src,$dst); # with defaults
$res = getPerspectiveTransform($src,$dst,$solveMethod);
The function calculates the 3 \times 3
matrix of a perspective transform so that: \f[\begin{bmatrix} t_i x'_i \\ t_i y'_i \\ t_i \end{bmatrix} = \texttt{map_matrix} \cdot \begin{bmatrix} x_i \\ y_i \\ 1 \end{bmatrix}\f] where \f[dst(i)=(x'_i,y'_i), src(i)=(x_i, y_i), i=0,1,2,3\f]
Parameters:
- src
-
Coordinates of quadrangle vertices in the source image.
- dst
-
Coordinates of the corresponding quadrangle vertices in the destination image.
- solveMethod
-
method passed to cv::solve (#DecompTypes)
See also: findHomography, warpPerspective, perspectiveTransform
getPerspectiveTransform ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
getAffineTransform
Signature: ([phys] src(l1,c1,r1); [phys] dst(l2,c2,r2); [o,phys] res(l3,c3,r3))
NO BROADCASTING.
$res = getAffineTransform($src,$dst);
@overload
getAffineTransform ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
getRectSubPix
Signature: ([phys] image(l1,c1,r1); indx [phys] patchSize(n2=2); float [phys] center(n3=2); [o,phys] patch(l4,c4,r4); int [phys] patchType())
Retrieves a pixel rectangle from an image with sub-pixel accuracy. NO BROADCASTING.
$patch = getRectSubPix($image,$patchSize,$center); # with defaults
$patch = getRectSubPix($image,$patchSize,$center,$patchType);
The function getRectSubPix extracts pixels from src: \f[patch(x, y) = src(x + \texttt{center.x} - ( \texttt{dst.cols} -1)*0.5, y + \texttt{center.y} - ( \texttt{dst.rows} -1)*0.5)\f] where the values of the pixels at non-integer coordinates are retrieved using bilinear interpolation. Every channel of multi-channel images is processed independently. Also the image should be a single channel or three channel image. While the center of the rectangle must be inside the image, parts of the rectangle may be outside.
Parameters:
- image
-
Source image.
- patchSize
-
Size of the extracted patch.
- center
-
Floating point coordinates of the center of the extracted rectangle within the source image. The center must be inside the image.
- patch
-
Extracted patch that has the size patchSize and the same number of channels as src .
- patchType
-
Depth of the extracted pixels. By default, they have the same depth as src .
See also: warpAffine, warpPerspective
getRectSubPix ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
logPolar
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); float [phys] center(n3=2); double [phys] M(); int [phys] flags())
Remaps an image to semilog-polar coordinates space. NO BROADCASTING.
$dst = logPolar($src,$center,$M,$flags);
@deprecated This function produces same result as cv::warpPolar(src, dst, src.size(), center, maxRadius, flags+WARP_POLAR_LOG); @internal Transform the source image using the following transformation (See @ref polar_remaps_reference_image "Polar remaps reference image d)"): \f[\begin{array}{l} dst( \rho , \phi ) = src(x,y) \\ dst.size() \leftarrow src.size() \end{array}\f] where \f[\begin{array}{l} I = (dx,dy) = (x - center.x,y - center.y) \\ \rho = M \cdot log_e(\texttt{magnitude} (I)) ,\\ \phi = Kangle \cdot \texttt{angle} (I) \\ \end{array}\f] and \f[\begin{array}{l} M = src.cols / log_e(maxRadius) \\ Kangle = src.rows / 2\Pi \\ \end{array}\f] The function emulates the human "foveal" vision and can be used for fast scale and rotation-invariant template matching, for object tracking and so forth. @note - The function can not operate in-place. - To calculate magnitude and angle in degrees #cartToPolar is used internally thus angles are measured from 0 to 360 with accuracy about 0.3 degrees. @endinternal
Parameters:
- src
-
Source image
- dst
-
Destination image. It will have same size and type as src.
- center
-
The transformation center; where the output precision is maximal
- M
-
Magnitude scale parameter. It determines the radius of the bounding circle to transform too.
- flags
-
A combination of interpolation methods, see #InterpolationFlags
See also: cv::linearPolar
logPolar ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
linearPolar
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); float [phys] center(n3=2); double [phys] maxRadius(); int [phys] flags())
Remaps an image to polar coordinates space. NO BROADCASTING.
$dst = linearPolar($src,$center,$maxRadius,$flags);
@deprecated This function produces same result as cv::warpPolar(src, dst, src.size(), center, maxRadius, flags) @internal Transform the source image using the following transformation (See @ref polar_remaps_reference_image "Polar remaps reference image c)"): \f[\begin{array}{l} dst( \rho , \phi ) = src(x,y) \\ dst.size() \leftarrow src.size() \end{array}\f] where \f[\begin{array}{l} I = (dx,dy) = (x - center.x,y - center.y) \\ \rho = Kmag \cdot \texttt{magnitude} (I) ,\\ \phi = angle \cdot \texttt{angle} (I) \end{array}\f] and \f[\begin{array}{l} Kx = src.cols / maxRadius \\ Ky = src.rows / 2\Pi \end{array}\f] @note - The function can not operate in-place. - To calculate magnitude and angle in degrees #cartToPolar is used internally thus angles are measured from 0 to 360 with accuracy about 0.3 degrees. @endinternal
Parameters:
- src
-
Source image
- dst
-
Destination image. It will have same size and type as src.
- center
-
The transformation center;
- maxRadius
-
The radius of the bounding circle to transform. It determines the inverse magnitude scale parameter too.
- flags
-
A combination of interpolation methods, see #InterpolationFlags
See also: cv::logPolar
linearPolar ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
warpPolar
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); indx [phys] dsize(n3=2); float [phys] center(n4=2); double [phys] maxRadius(); int [phys] flags())
Remaps an image to polar or semilog-polar coordinates space NO BROADCASTING.
$dst = warpPolar($src,$dsize,$center,$maxRadius,$flags);
@anchor polar_remaps_reference_image ![Polar remaps reference](pics/polar_remap_doc.png) Transform the source image using the following transformation: \f[ dst(\rho , \phi ) = src(x,y) \f] where \f[ \begin{array}{l} \vec{I} = (x - center.x, \;y - center.y) \\ \phi = Kangle \cdot \texttt{angle} (\vec{I}) \\ \rho = \left\{\begin{matrix} Klin \cdot \texttt{magnitude} (\vec{I}) & default \\ Klog \cdot log_e(\texttt{magnitude} (\vec{I})) & if \; semilog \\ \end{matrix}\right. \end{array} \f] and \f[ \begin{array}{l} Kangle = dsize.height / 2\Pi \\ Klin = dsize.width / maxRadius \\ Klog = dsize.width / log_e(maxRadius) \\ \end{array} \f] \par Linear vs semilog mapping Polar mapping can be linear or semi-log. Add one of #WarpPolarMode to `flags` to specify the polar mapping mode. Linear is the default mode. The semilog mapping emulates the human "foveal" vision that permit very high acuity on the line of sight (central vision) in contrast to peripheral vision where acuity is minor. \par Option on `dsize`: - if both values in `dsize <=0 ` (default), the destination image will have (almost) same area of source bounding circle: \f[\begin{array}{l} dsize.area \leftarrow (maxRadius^2 \cdot \Pi) \\ dsize.width = \texttt{cvRound}(maxRadius) \\ dsize.height = \texttt{cvRound}(maxRadius \cdot \Pi) \\ \end{array}\f] - if only `dsize.height <= 0`, the destination image area will be proportional to the bounding circle area but scaled by `Kx * Kx`: \f[\begin{array}{l} dsize.height = \texttt{cvRound}(dsize.width \cdot \Pi) \\ \end{array} \f] - if both values in `dsize > 0 `, the destination image will have the given size therefore the area of the bounding circle will be scaled to `dsize`. \par Reverse mapping You can get reverse mapping adding #WARP_INVERSE_MAP to `flags` \snippet polar_transforms.cpp InverseMap In addiction, to calculate the original coordinate from a polar mapped coordinate (rho, phi)->(x, y)
: \snippet polar_transforms.cpp InverseCoordinate @note - The function can not operate in-place. - To calculate magnitude and angle in degrees #cartToPolar is used internally thus angles are measured from 0 to 360 with accuracy about 0.3 degrees. - This function uses #remap. Due to current implementation limitations the size of an input and output images should be less than 32767x32767.
Parameters:
- src
-
Source image.
- dst
-
Destination image. It will have same type as src.
- dsize
-
The destination image size (see description for valid options).
- center
-
The transformation center.
- maxRadius
-
The radius of the bounding circle to transform. It determines the inverse magnitude scale parameter too.
- flags
-
A combination of interpolation methods, #InterpolationFlags + #WarpPolarMode. - Add #WARP_POLAR_LINEAR to select linear polar mapping (default) - Add #WARP_POLAR_LOG to select semilog polar mapping - Add #WARP_INVERSE_MAP for reverse mapping.
See also: cv::remap
warpPolar ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
integral
Signature: ([phys] src(l1,c1,r1); [o,phys] sum(l2,c2,r2); [o,phys] sqsum(l3,c3,r3); [o,phys] tilted(l4,c4,r4); int [phys] sdepth(); int [phys] sqdepth())
Calculates the integral of an image. NO BROADCASTING.
($sum,$sqsum,$tilted) = integral($src); # with defaults
($sum,$sqsum,$tilted) = integral($src,$sdepth,$sqdepth);
The function calculates one or more integral images for the source image as follows: \f[\texttt{sum} (X,Y) = \sum _{x<X,y<Y} \texttt{image} (x,y)\f] \f[\texttt{sqsum} (X,Y) = \sum _{x<X,y<Y} \texttt{image} (x,y)^2\f] \f[\texttt{tilted} (X,Y) = \sum _{y<Y,abs(x-X+1) \leq Y-y-1} \texttt{image} (x,y)\f] Using these integral images, you can calculate sum, mean, and standard deviation over a specific up-right or rotated rectangular region of the image in a constant time, for example: \f[\sum _{x_1 \leq x < x_2, \, y_1 \leq y < y_2} \texttt{image} (x,y) = \texttt{sum} (x_2,y_2)- \texttt{sum} (x_1,y_2)- \texttt{sum} (x_2,y_1)+ \texttt{sum} (x_1,y_1)\f] It makes possible to do a fast blurring or fast block correlation with a variable window size, for example. In case of multi-channel images, sums for each channel are accumulated independently. As a practical example, the next figure shows the calculation of the integral of a straight rectangle Rect(3,3,3,2) and of a tilted rectangle Rect(5,1,2,3) . The selected pixels in the original image are shown, as well as the relative pixels in the integral images sum and tilted . ![integral calculation example](pics/integral.png) W \times H
, 8-bit or floating-point (32f or 64f). (W+1)\times (H+1)
, 32-bit integer or floating-point (32f or 64f). (W+1)\times (H+1)
, double-precision floating-point (64f) array. (W+1)\times (H+1)
array with the same data type as sum.
Parameters:
- src
-
input image as
- sum
-
integral image as
- sqsum
-
integral image for squared pixel values; it is
- tilted
-
integral for the image rotated by 45 degrees; it is
- sdepth
-
desired depth of the integral and the tilted integral images, CV_32S, CV_32F, or CV_64F.
- sqdepth
-
desired depth of the integral image of squared pixel values, CV_32F or CV_64F.
integral ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
integral2
Signature: ([phys] src(l1,c1,r1); [o,phys] sum(l2,c2,r2); int [phys] sdepth())
NO BROADCASTING.
$sum = integral2($src); # with defaults
$sum = integral2($src,$sdepth);
@overload
integral2 ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
integral3
Signature: ([phys] src(l1,c1,r1); [o,phys] sum(l2,c2,r2); [o,phys] sqsum(l3,c3,r3); int [phys] sdepth(); int [phys] sqdepth())
NO BROADCASTING.
($sum,$sqsum) = integral3($src); # with defaults
($sum,$sqsum) = integral3($src,$sdepth,$sqdepth);
@overload
integral3 ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
accumulate
Signature: ([phys] src(l1,c1,r1); [io,phys] dst(l2,c2,r2); [phys] mask(l3,c3,r3))
Adds an image to the accumulator image.
accumulate($src,$dst); # with defaults
accumulate($src,$dst,$mask);
The function adds src or some of its elements to dst : \f[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] The function supports multi-channel images. Each channel is processed independently. The function cv::accumulate can be used, for example, to collect statistics of a scene background viewed by a still camera and for the further foreground-background segmentation.
Parameters:
- src
-
Input image of type CV_8UC(n), CV_16UC(n), CV_32FC(n) or CV_64FC(n), where n is a positive integer.
- dst
-
%Accumulator image with the same number of channels as input image, and a depth of CV_32F or CV_64F.
- mask
-
Optional operation mask.
See also: accumulateSquare, accumulateProduct, accumulateWeighted
accumulate ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
accumulateSquare
Signature: ([phys] src(l1,c1,r1); [io,phys] dst(l2,c2,r2); [phys] mask(l3,c3,r3))
Adds the square of a source image to the accumulator image.
accumulateSquare($src,$dst); # with defaults
accumulateSquare($src,$dst,$mask);
The function adds the input image src or its selected region, raised to a power of 2, to the accumulator dst : \f[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src} (x,y)^2 \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] The function supports multi-channel images. Each channel is processed independently.
Parameters:
- src
-
Input image as 1- or 3-channel, 8-bit or 32-bit floating point.
- dst
-
%Accumulator image with the same number of channels as input image, 32-bit or 64-bit floating-point.
- mask
-
Optional operation mask.
See also: accumulateSquare, accumulateProduct, accumulateWeighted
accumulateSquare ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
accumulateProduct
Signature: ([phys] src1(l1,c1,r1); [phys] src2(l2,c2,r2); [io,phys] dst(l3,c3,r3); [phys] mask(l4,c4,r4))
Adds the per-element product of two input images to the accumulator image.
accumulateProduct($src1,$src2,$dst); # with defaults
accumulateProduct($src1,$src2,$dst,$mask);
The function adds the product of two images or their selected regions to the accumulator dst : \f[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src1} (x,y) \cdot \texttt{src2} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] The function supports multi-channel images. Each channel is processed independently.
Parameters:
- src1
-
First input image, 1- or 3-channel, 8-bit or 32-bit floating point.
- src2
-
Second input image of the same type and the same size as src1 .
- dst
-
%Accumulator image with the same number of channels as input images, 32-bit or 64-bit floating-point.
- mask
-
Optional operation mask.
See also: accumulate, accumulateSquare, accumulateWeighted
accumulateProduct ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
accumulateWeighted
Signature: ([phys] src(l1,c1,r1); [io,phys] dst(l2,c2,r2); double [phys] alpha(); [phys] mask(l4,c4,r4))
Updates a running average.
accumulateWeighted($src,$dst,$alpha); # with defaults
accumulateWeighted($src,$dst,$alpha,$mask);
The function calculates the weighted sum of the input image src and the accumulator dst so that dst becomes a running average of a frame sequence: \f[\texttt{dst} (x,y) \leftarrow (1- \texttt{alpha} ) \cdot \texttt{dst} (x,y) + \texttt{alpha} \cdot \texttt{src} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] That is, alpha regulates the update speed (how fast the accumulator "forgets" about earlier images). The function supports multi-channel images. Each channel is processed independently.
Parameters:
- src
-
Input image as 1- or 3-channel, 8-bit or 32-bit floating point.
- dst
-
%Accumulator image with the same number of channels as input image, 32-bit or 64-bit floating-point.
- alpha
-
Weight of the input image.
- mask
-
Optional operation mask.
See also: accumulate, accumulateSquare, accumulateProduct
accumulateWeighted ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
phaseCorrelate
Signature: ([phys] src1(l1,c1,r1); [phys] src2(l2,c2,r2); [phys] window(l3,c3,r3); double [o,phys] response(); double [o,phys] res(n5=2))
The function is used to detect translational shifts that occur between two images.
($response,$res) = phaseCorrelate($src1,$src2); # with defaults
($response,$res) = phaseCorrelate($src1,$src2,$window);
The operation takes advantage of the Fourier shift theorem for detecting the translational shift in the frequency domain. It can be used for fast image registration as well as motion estimation. For more information please see <http://en.wikipedia.org/wiki/Phase_correlation> Calculates the cross-power spectrum of two supplied source arrays. The arrays are padded if needed with getOptimalDFTSize. The function performs the following equations: =over =back \mathcal{F}
is the forward DFT. - It then computes the cross-power spectrum of each frequency domain array: \f[R = \frac{ \mathbf{G}_a \mathbf{G}_b^*}{|\mathbf{G}_a \mathbf{G}_b^*|}\f] - Next the cross-correlation is converted back into the time domain via the inverse DFT: \f[r = \mathcal{F}^{-1}\{R\}\f] - Finally, it computes the peak location and computes a 5x5 weighted centroid around the peak to achieve sub-pixel accuracy. \f[(\Delta x, \Delta y) = \texttt{weightedCentroid} \{\arg \max_{(x, y)}\{r\}\}\f] - If non-zero, the response parameter is computed as the sum of the elements of r within the 5x5 centroid around the peak location. It is normalized to a maximum of 1 (meaning there is a single peak) and will be smaller when there are multiple peaks.
Parameters:
- src1
-
Source floating point array (CV_32FC1 or CV_64FC1)
- src2
-
Source floating point array (CV_32FC1 or CV_64FC1)
- window
-
Floating point array with windowing coefficients to reduce edge effects (optional).
- response
-
Signal power within the 5x5 centroid around the peak, between 0 and 1 (optional).
Returns: detected phase shift (sub-pixel) between the two arrays.
See also: dft, getOptimalDFTSize, idft, mulSpectrums createHanningWindow
phaseCorrelate ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
createHanningWindow
Signature: ([o,phys] dst(l1,c1,r1); indx [phys] winSize(n2=2); int [phys] type())
This function computes a Hanning window coefficients in two dimensions. NO BROADCASTING.
$dst = createHanningWindow($winSize,$type);
See (http://en.wikipedia.org/wiki/Hann_function) and (http://en.wikipedia.org/wiki/Window_function) for more information. An example is shown below:
// create hanning window of size 100x100 and type CV_32F
Mat hann;
createHanningWindow(hann, Size(100, 100), CV_32F);
Parameters:
- dst
-
Destination array to place Hann coefficients in
- winSize
-
The window size specifications (both width and height must be > 1)
- type
-
Created array type
createHanningWindow ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
divSpectrums
Signature: ([phys] a(l1,c1,r1); [phys] b(l2,c2,r2); [o,phys] c(l3,c3,r3); int [phys] flags(); byte [phys] conjB())
Performs the per-element division of the first Fourier spectrum by the second Fourier spectrum. NO BROADCASTING.
$c = divSpectrums($a,$b,$flags); # with defaults
$c = divSpectrums($a,$b,$flags,$conjB);
The function cv::divSpectrums performs the per-element division of the first array by the second array. The arrays are CCS-packed or complex matrices that are results of a real or complex Fourier transform.
Parameters:
- a
-
first input array.
- b
-
second input array of the same size and type as src1 .
- c
-
output array of the same size and type as src1 .
- flags
-
operation flags; currently, the only supported flag is cv::DFT_ROWS, which indicates that each row of src1 and src2 is an independent 1D Fourier spectrum. If you do not want to use this flag, then simply add a `0` as value.
- conjB
-
optional flag that conjugates the second input array before the multiplication (true) or not (false).
divSpectrums ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
threshold
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); double [phys] thresh(); double [phys] maxval(); int [phys] type(); double [o,phys] res())
Applies a fixed-level threshold to each array element. NO BROADCASTING.
($dst,$res) = threshold($src,$thresh,$maxval,$type);
The function applies fixed-level thresholding to a multiple-channel array. The function is typically used to get a bi-level (binary) image out of a grayscale image ( #compare could be also used for this purpose) or for removing a noise, that is, filtering out pixels with too small or too large values. There are several types of thresholding supported by the function. They are determined by type parameter. Also, the special values #THRESH_OTSU or #THRESH_TRIANGLE may be combined with one of the above values. In these cases, the function determines the optimal threshold value using the Otsu's or Triangle algorithm and uses it instead of the specified thresh. @note Currently, the Otsu's and Triangle methods are implemented only for 8-bit single-channel images.
Parameters:
- src
-
input array (multiple-channel, 8-bit or 32-bit floating point).
- dst
-
output array of the same size and type and the same number of channels as src.
- thresh
-
threshold value.
- maxval
-
maximum value to use with the #THRESH_BINARY and #THRESH_BINARY_INV thresholding types.
- type
-
thresholding type (see #ThresholdTypes).
Returns: the computed threshold value if Otsu's or Triangle methods used.
See also: adaptiveThreshold, findContours, compare, min, max
threshold ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
adaptiveThreshold
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); double [phys] maxValue(); int [phys] adaptiveMethod(); int [phys] thresholdType(); int [phys] blockSize(); double [phys] C())
Applies an adaptive threshold to an array. NO BROADCASTING.
$dst = adaptiveThreshold($src,$maxValue,$adaptiveMethod,$thresholdType,$blockSize,$C);
The function transforms a grayscale image to a binary image according to the formulae: =over =back T(x,y)
is a threshold calculated individually for each pixel (see adaptiveMethod parameter). The function can process the image in-place.
Parameters:
- src
-
Source 8-bit single-channel image.
- dst
-
Destination image of the same size and the same type as src.
- maxValue
-
Non-zero value assigned to the pixels for which the condition is satisfied
- adaptiveMethod
-
Adaptive thresholding algorithm to use, see #AdaptiveThresholdTypes. The #BORDER_REPLICATE | #BORDER_ISOLATED is used to process boundaries.
- thresholdType
-
Thresholding type that must be either #THRESH_BINARY or #THRESH_BINARY_INV, see #ThresholdTypes.
- blockSize
-
Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on.
- C
-
Constant subtracted from the mean or weighted mean (see the details below). Normally, it is positive but may be zero or negative as well.
See also: threshold, blur, GaussianBlur
adaptiveThreshold ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
pyrDown
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); indx [phys] dstsize(n3); int [phys] borderType())
Blurs an image and downsamples it. NO BROADCASTING.
$dst = pyrDown($src); # with defaults
$dst = pyrDown($src,$dstsize,$borderType);
By default, size of the output image is computed as `Size((src.cols+1)/2, (src.rows+1)/2)`, but in any case, the following conditions should be satisfied: \f[\begin{array}{l} | \texttt{dstsize.width} *2-src.cols| \leq 2 \\ | \texttt{dstsize.height} *2-src.rows| \leq 2 \end{array}\f] The function performs the downsampling step of the Gaussian pyramid construction. First, it convolves the source image with the kernel: \f[\frac{1}{256} \begin{bmatrix} 1 & 4 & 6 & 4 & 1 \\ 4 & 16 & 24 & 16 & 4 \\ 6 & 24 & 36 & 24 & 6 \\ 4 & 16 & 24 & 16 & 4 \\ 1 & 4 & 6 & 4 & 1 \end{bmatrix}\f] Then, it downsamples the image by rejecting even rows and columns.
Parameters:
- src
-
input image.
- dst
-
output image; it has the specified size and the same type as src.
- dstsize
-
size of the output image.
- borderType
-
Pixel extrapolation method, see #BorderTypes (#BORDER_CONSTANT isn't supported)
pyrDown ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
pyrUp
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); indx [phys] dstsize(n3); int [phys] borderType())
Upsamples an image and then blurs it. NO BROADCASTING.
$dst = pyrUp($src); # with defaults
$dst = pyrUp($src,$dstsize,$borderType);
By default, size of the output image is computed as `Size(src.cols*2, (src.rows*2)`, but in any case, the following conditions should be satisfied: \f[\begin{array}{l} | \texttt{dstsize.width} -src.cols*2| \leq ( \texttt{dstsize.width} \mod 2) \\ | \texttt{dstsize.height} -src.rows*2| \leq ( \texttt{dstsize.height} \mod 2) \end{array}\f] The function performs the upsampling step of the Gaussian pyramid construction, though it can actually be used to construct the Laplacian pyramid. First, it upsamples the source image by injecting even zero rows and columns and then convolves the result with the same kernel as in pyrDown multiplied by 4.
Parameters:
- src
-
input image.
- dst
-
output image. It has the specified size and the same type as src .
- dstsize
-
size of the output image.
- borderType
-
Pixel extrapolation method, see #BorderTypes (only #BORDER_DEFAULT is supported)
pyrUp ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
calcHist
Signature: (int [phys] channels(n2d0); [phys] mask(l3,c3,r3); [o,phys] hist(l4,c4,r4); int [phys] histSize(n5d0); float [phys] ranges(n6d0); byte [phys] accumulate(); vector_MatWrapper * images)
NO BROADCASTING.
$hist = calcHist($images,$channels,$mask,$histSize,$ranges); # with defaults
$hist = calcHist($images,$channels,$mask,$histSize,$ranges,$accumulate);
@overload
calcHist ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
calcBackProject
Signature: (int [phys] channels(n2d0); [phys] hist(l3,c3,r3); [o,phys] dst(l4,c4,r4); float [phys] ranges(n5d0); double [phys] scale(); vector_MatWrapper * images)
NO BROADCASTING.
$dst = calcBackProject($images,$channels,$hist,$ranges,$scale);
@overload
calcBackProject ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
compareHist
Signature: ([phys] H1(l1,c1,r1); [phys] H2(l2,c2,r2); int [phys] method(); double [o,phys] res())
Compares two histograms.
$res = compareHist($H1,$H2,$method);
The function cv::compareHist compares two dense or two sparse histograms using the specified method. The function returns d(H_1, H_2)
. While the function works well with 1-, 2-, 3-dimensional dense histograms, it may not be suitable for high-dimensional sparse histograms. In such histograms, because of aliasing and sampling problems, the coordinates of non-zero histogram bins can slightly shift. To compare such histograms or more general sparse configurations of weighted points, consider using the #EMD function.
Parameters:
- H1
-
First compared histogram.
- H2
-
Second compared histogram of the same size as H1 .
- method
-
Comparison method, see #HistCompMethods
compareHist ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
equalizeHist
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2))
Equalizes the histogram of a grayscale image. NO BROADCASTING.
$dst = equalizeHist($src);
The function equalizes the histogram of the input image using the following algorithm: - Calculate the histogram H
for src . - Normalize the histogram so that the sum of histogram bins is 255. - Compute the integral of the histogram: \f[H'_i = \sum _{0 \le j < i} H(j)\f] - Transform the image using H'
as a look-up table: \texttt{dst}(x,y) = H'(\texttt{src}(x,y))
The algorithm normalizes the brightness and increases the contrast of the image.
Parameters:
- src
-
Source 8-bit single channel image.
- dst
-
Destination image of the same size and type as src .
equalizeHist ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
EMD
Signature: ([phys] signature1(l1,c1,r1); [phys] signature2(l2,c2,r2); int [phys] distType(); [phys] cost(l4,c4,r4); float [io,phys] lowerBound(n5); [o,phys] flow(l6,c6,r6); float [o,phys] res())
Computes the "minimal work" distance between two weighted point configurations. NO BROADCASTING.
($flow,$res) = EMD($signature1,$signature2,$distType); # with defaults
($flow,$res) = EMD($signature1,$signature2,$distType,$cost,$lowerBound);
The function computes the earth mover distance and/or a lower boundary of the distance between the two weighted point configurations. One of the applications described in @cite RubnerSept98, @cite Rubner2000 is multi-dimensional histogram comparison for image retrieval. EMD is a transportation problem that is solved using some modification of a simplex algorithm, thus the complexity is exponential in the worst case, though, on average it is much faster. In the case of a real metric the lower boundary can be calculated even faster (using linear-time algorithm) and it can be used to determine roughly whether the two signatures are far enough so that they cannot relate to the same object. \texttt{size1}\times \texttt{dims}+1
floating-point matrix. Each row stores the point weight followed by the point coordinates. The matrix is allowed to have a single column (weights only) if the user-defined cost matrix is used. The weights must be non-negative and have at least one non-zero value. \texttt{size1}\times \texttt{size2}
cost matrix. Also, if a cost matrix is used, lower boundary lowerBound cannot be calculated because it needs a metric function. *lowerBound . If the calculated distance between mass centers is greater or equal to *lowerBound (it means that the signatures are far enough), the function does not calculate EMD. In any case *lowerBound is set to the calculated distance between mass centers on return. Thus, if you want to calculate both distance between mass centers and EMD, *lowerBound should be set to 0. \texttt{size1} \times \texttt{size2}
flow matrix: \texttt{flow}_{i,j}
is a flow from i
-th point of signature1 to j
-th point of signature2 .
Parameters:
- signature1
-
First signature, a
- signature2
-
Second signature of the same format as signature1 , though the number of rows may be different. The total weights may be different. In this case an extra "dummy" point is added to either signature1 or signature2. The weights must be non-negative and have at least one non-zero value.
- distType
-
Used metric. See #DistanceTypes.
- cost
-
User-defined
- lowerBound
-
Optional input/output parameter: lower boundary of a distance between the two signatures that is a distance between mass centers. The lower boundary may not be calculated if the user-defined cost matrix is used, the total weights of point configurations are not equal, or if the signatures consist of weights only (the signature matrices have a single column). You **must** initialize
- flow
-
Resultant
EMD ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
watershed
Signature: ([phys] image(l1,c1,r1); [io,phys] markers(l2,c2,r2))
Performs a marker-based image segmentation using the watershed algorithm.
watershed($image,$markers);
The function implements one of the variants of watershed, non-parametric marker-based segmentation algorithm, described in @cite Meyer92 . Before passing the image to the function, you have to roughly outline the desired regions in the image markers with positive (\>0) indices. So, every region is represented as one or more connected components with the pixel values 1, 2, 3, and so on. Such markers can be retrieved from a binary mask using #findContours and #drawContours (see the watershed.cpp demo). The markers are "seeds" of the future image regions. All the other pixels in markers , whose relation to the outlined regions is not known and should be defined by the algorithm, should be set to 0's. In the function output, each pixel in markers is set to a value of the "seed" components or to -1 at boundaries between the regions. @note Any two neighbor connected components are not necessarily separated by a watershed boundary (-1's pixels); for example, they can touch each other in the initial marker image passed to the function.
Parameters:
- image
-
Input 8-bit 3-channel image.
- markers
-
Input/output 32-bit single-channel image (map) of markers. It should have the same size as image .
See also: findContours
watershed ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
pyrMeanShiftFiltering
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); double [phys] sp(); double [phys] sr(); int [phys] maxLevel(); TermCriteriaWrapper * termcrit)
Performs initial step of meanshift segmentation of an image. NO BROADCASTING.
$dst = pyrMeanShiftFiltering($src,$sp,$sr); # with defaults
$dst = pyrMeanShiftFiltering($src,$sp,$sr,$maxLevel,$termcrit);
The function implements the filtering stage of meanshift segmentation, that is, the output of the function is the filtered "posterized" image with color gradients and fine-grain texture flattened. At every pixel (X,Y) of the input image (or down-sized input image, see below) the function executes meanshift iterations, that is, the pixel (X,Y) neighborhood in the joint space-color hyperspace is considered: \f[(x,y): X- \texttt{sp} \le x \le X+ \texttt{sp} , Y- \texttt{sp} \le y \le Y+ \texttt{sp} , ||(R,G,B)-(r,g,b)|| \le \texttt{sr}\f] where (R,G,B) and (r,g,b) are the vectors of color components at (X,Y) and (x,y), respectively (though, the algorithm does not depend on the color space used, so any 3-component color space can be used instead). Over the neighborhood the average spatial value (X',Y') and average color vector (R',G',B') are found and they act as the neighborhood center on the next iteration: \f[(X,Y)~(X',Y'), (R,G,B)~(R',G',B').\f] After the iterations over, the color components of the initial pixel (that is, the pixel from where the iterations started) are set to the final value (average color at the last iteration): \f[I(X,Y) <- (R*,G*,B*)\f] When maxLevel \> 0, the gaussian pyramid of maxLevel+1 levels is built, and the above procedure is run on the smallest layer first. After that, the results are propagated to the larger layer and the iterations are run again only on those pixels where the layer colors differ by more than sr from the lower-resolution layer of the pyramid. That makes boundaries of color regions sharper. Note that the results will be actually different from the ones obtained by running the meanshift procedure on the whole original image (i.e. when maxLevel==0).
Parameters:
- src
-
The source 8-bit, 3-channel image.
- dst
-
The destination image of the same format and the same size as the source.
- sp
-
The spatial window radius.
- sr
-
The color window radius.
- maxLevel
-
Maximum level of the pyramid for the segmentation.
- termcrit
-
Termination criteria: when to stop meanshift iterations.
pyrMeanShiftFiltering ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
grabCut
Signature: ([phys] img(l1,c1,r1); [io,phys] mask(l2,c2,r2); indx [phys] rect(n3=4); [io,phys] bgdModel(l4,c4,r4); [io,phys] fgdModel(l5,c5,r5); int [phys] iterCount(); int [phys] mode())
Runs the GrabCut algorithm.
grabCut($img,$mask,$rect,$bgdModel,$fgdModel,$iterCount); # with defaults
grabCut($img,$mask,$rect,$bgdModel,$fgdModel,$iterCount,$mode);
The function implements the [GrabCut image segmentation algorithm](http://en.wikipedia.org/wiki/GrabCut).
Parameters:
- img
-
Input 8-bit 3-channel image.
- mask
-
Input/output 8-bit single-channel mask. The mask is initialized by the function when mode is set to #GC_INIT_WITH_RECT. Its elements may have one of the #GrabCutClasses.
- rect
-
ROI containing a segmented object. The pixels outside of the ROI are marked as "obvious background". The parameter is only used when mode==#GC_INIT_WITH_RECT .
- bgdModel
-
Temporary array for the background model. Do not modify it while you are processing the same image.
- fgdModel
-
Temporary arrays for the foreground model. Do not modify it while you are processing the same image.
- iterCount
-
Number of iterations the algorithm should make before returning the result. Note that the result can be refined with further calls with mode==#GC_INIT_WITH_MASK or mode==GC_EVAL .
- mode
-
Operation mode that could be one of the #GrabCutModes
grabCut ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
distanceTransformWithLabels
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); [o,phys] labels(l3,c3,r3); int [phys] distanceType(); int [phys] maskSize(); int [phys] labelType())
Calculates the distance to the closest zero pixel for each pixel of the source image. NO BROADCASTING.
($dst,$labels) = distanceTransformWithLabels($src,$distanceType,$maskSize); # with defaults
($dst,$labels) = distanceTransformWithLabels($src,$distanceType,$maskSize,$labelType);
The function cv::distanceTransform calculates the approximate or precise distance from every binary image pixel to the nearest zero pixel. For zero image pixels, the distance will obviously be zero. When maskSize == #DIST_MASK_PRECISE and distanceType == #DIST_L2 , the function runs the algorithm described in @cite Felzenszwalb04 . This algorithm is parallelized with the TBB library. In other cases, the algorithm @cite Borgefors86 is used. This means that for a pixel the function finds the shortest path to the nearest zero pixel consisting of basic shifts: horizontal, vertical, diagonal, or knight's move (the latest is available for a 5\times 5
mask). The overall distance is calculated as a sum of these basic distances. Since the distance function should be symmetric, all of the horizontal and vertical shifts must have the same cost (denoted as a ), all the diagonal shifts must have the same cost (denoted as `b`), and all knight's moves must have the same cost (denoted as `c`). For the #DIST_C and #DIST_L1 types, the distance is calculated precisely, whereas for #DIST_L2 (Euclidean distance) the distance can be calculated only with a relative error (a 5\times 5
mask gives more accurate results). For `a`,`b`, and `c`, OpenCV uses the values suggested in the original paper: =over =item * DIST_L1: `a = 1, b = 2` =item * DIST_C: `a = 1, b = 1` =back Typically, for a fast, coarse distance estimation #DIST_L2, a 3\times 3
mask is used. For a more accurate distance estimation #DIST_L2, a 5\times 5
mask or the precise algorithm is used. Note that both the precise and the approximate algorithms are linear on the number of pixels. This variant of the function does not only compute the minimum distance for each pixel (x, y)
but also identifies the nearest connected component consisting of zero pixels (labelType==#DIST_LABEL_CCOMP) or the nearest zero pixel (labelType==#DIST_LABEL_PIXEL). Index of the component/pixel is stored in `labels(x, y)`. When labelType==#DIST_LABEL_CCOMP, the function automatically finds connected components of zero pixels in the input image and marks them with distinct labels. When labelType==#DIST_LABEL_PIXEL, the function scans through the input image and marks all the zero pixels with distinct labels. In this mode, the complexity is still linear. That is, the function provides a very fast way to compute the Voronoi diagram for a binary image. Currently, the second variant can use only the approximate distance transform algorithm, i.e. maskSize=#DIST_MASK_PRECISE is not supported yet. 3\times 3
mask gives the same result as 5\times 5
or any larger aperture.
Parameters:
- src
-
8-bit, single-channel (binary) source image.
- dst
-
Output image with calculated distances. It is a 8-bit or 32-bit floating-point, single-channel image of the same size as src.
- labels
-
Output 2D array of labels (the discrete Voronoi diagram). It has the type CV_32SC1 and the same size as src.
- distanceType
-
Type of distance, see #DistanceTypes
- maskSize
-
Size of the distance transform mask, see #DistanceTransformMasks. #DIST_MASK_PRECISE is not supported by this variant. In case of the #DIST_L1 or #DIST_C distance type, the parameter is forced to 3 because a
- labelType
-
Type of the label array to build, see #DistanceTransformLabelTypes.
distanceTransformWithLabels ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
distanceTransform
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); int [phys] distanceType(); int [phys] maskSize(); int [phys] dstType())
NO BROADCASTING.
$dst = distanceTransform($src,$distanceType,$maskSize); # with defaults
$dst = distanceTransform($src,$distanceType,$maskSize,$dstType);
@overload 3\times 3
mask gives the same result as 5\times 5
or any larger aperture.
Parameters:
- src
-
8-bit, single-channel (binary) source image.
- dst
-
Output image with calculated distances. It is a 8-bit or 32-bit floating-point, single-channel image of the same size as src .
- distanceType
-
Type of distance, see #DistanceTypes
- maskSize
-
Size of the distance transform mask, see #DistanceTransformMasks. In case of the #DIST_L1 or #DIST_C distance type, the parameter is forced to 3 because a
- dstType
-
Type of output image. It can be CV_8U or CV_32F. Type CV_8U can be used only for the first variant of the function and distanceType == #DIST_L1.
distanceTransform ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
floodFill
Signature: ([io,phys] image(l1,c1,r1); [io,phys] mask(l2,c2,r2); indx [phys] seedPoint(n3=2); double [phys] newVal(n4=4); indx [o,phys] rect(n5=4); double [phys] loDiff(n6); double [phys] upDiff(n7); int [phys] flags(); int [o,phys] res())
Fills a connected component with the given color.
($rect,$res) = floodFill($image,$mask,$seedPoint,$newVal); # with defaults
($rect,$res) = floodFill($image,$mask,$seedPoint,$newVal,$loDiff,$upDiff,$flags);
The function cv::floodFill fills a connected component starting from the seed point with the specified color. The connectivity is determined by the color/brightness closeness of the neighbor pixels. The pixel at (x,y)
is considered to belong to the repainted domain if: - in case of a grayscale image and floating range \f[\texttt{src} (x',y')- \texttt{loDiff} \leq \texttt{src} (x,y) \leq \texttt{src} (x',y')+ \texttt{upDiff}\f] - in case of a grayscale image and fixed range \f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)- \texttt{loDiff} \leq \texttt{src} (x,y) \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)+ \texttt{upDiff}\f] - in case of a color image and floating range \f[\texttt{src} (x',y')_r- \texttt{loDiff} _r \leq \texttt{src} (x,y)_r \leq \texttt{src} (x',y')_r+ \texttt{upDiff} _r,\f] \f[\texttt{src} (x',y')_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} (x',y')_g+ \texttt{upDiff} _g\f] and \f[\texttt{src} (x',y')_b- \texttt{loDiff} _b \leq \texttt{src} (x,y)_b \leq \texttt{src} (x',y')_b+ \texttt{upDiff} _b\f] - in case of a color image and fixed range \f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_r- \texttt{loDiff} _r \leq \texttt{src} (x,y)_r \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_r+ \texttt{upDiff} _r,\f] \f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_g+ \texttt{upDiff} _g\f] and \f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_b- \texttt{loDiff} _b \leq \texttt{src} (x,y)_b \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_b+ \texttt{upDiff} _b\f] where src(x',y')
is the value of one of pixel neighbors that is already known to belong to the component. That is, to be added to the connected component, a color/brightness of the pixel should be close enough to: =over =item * Color/brightness of the seed point in case of a fixed range. =back Use these functions to either mark a connected component with the specified color in-place, or build a mask and then extract the contour, or copy the region to another image, and so on. \<\< 8 ) will consider 4 nearest neighbours and fill the mask with a value of 255. The following additional options occupy higher bits and therefore may be further combined with the connectivity and mask fill values using bit-wise or (|), see #FloodFillFlags. @note Since the mask is larger than the filled image, a pixel (x, y)
in image corresponds to the pixel (x+1, y+1)
in the mask .
Parameters:
- image
-
Input/output 1- or 3-channel, 8-bit, or floating-point image. It is modified by the function unless the #FLOODFILL_MASK_ONLY flag is set in the second variant of the function. See the details below.
- mask
-
Operation mask that should be a single-channel 8-bit image, 2 pixels wider and 2 pixels taller than image. Since this is both an input and output parameter, you must take responsibility of initializing it. Flood-filling cannot go across non-zero pixels in the input mask. For example, an edge detector output can be used as a mask to stop filling at edges. On output, pixels in the mask corresponding to filled pixels in the image are set to 1 or to the a value specified in flags as described below. Additionally, the function fills the border of the mask with ones to simplify internal processing. It is therefore possible to use the same mask in multiple calls to the function to make sure the filled areas do not overlap.
- seedPoint
-
Starting point.
- newVal
-
New value of the repainted domain pixels.
- loDiff
-
Maximal lower brightness/color difference between the currently observed pixel and one of its neighbors belonging to the component, or a seed pixel being added to the component.
- upDiff
-
Maximal upper brightness/color difference between the currently observed pixel and one of its neighbors belonging to the component, or a seed pixel being added to the component.
- rect
-
Optional output parameter set by the function to the minimum bounding rectangle of the repainted domain.
- flags
-
Operation flags. The first 8 bits contain a connectivity value. The default value of 4 means that only the four nearest neighbor pixels (those that share an edge) are considered. A connectivity value of 8 means that the eight nearest neighbor pixels (those that share a corner) will be considered. The next 8 bits (8-16) contain a value between 1 and 255 with which to fill the mask (the default value is 1). For example, 4 | ( 255
See also: findContours
floodFill ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
blendLinear
Signature: ([phys] src1(l1,c1,r1); [phys] src2(l2,c2,r2); [phys] weights1(l3,c3,r3); [phys] weights2(l4,c4,r4); [o,phys] dst(l5,c5,r5))
NO BROADCASTING.
$dst = blendLinear($src1,$src2,$weights1,$weights2);
@overload variant without `mask` parameter
blendLinear ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
cvtColor
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); int [phys] code(); int [phys] dstCn())
Converts an image from one color space to another. NO BROADCASTING.
$dst = cvtColor($src,$code); # with defaults
$dst = cvtColor($src,$code,$dstCn);
The function converts an input image from one color space to another. In case of a transformation to-from RGB color space, the order of the channels should be specified explicitly (RGB or BGR). Note that the default color format in OpenCV is often referred to as RGB but it is actually BGR (the bytes are reversed). So the first byte in a standard (24-bit) color image will be an 8-bit Blue component, the second byte will be Green, and the third byte will be Red. The fourth, fifth, and sixth bytes would then be the second pixel (Blue, then Green, then Red), and so on. The conventional ranges for R, G, and B channel values are: =over =item * 0 to 255 for CV_8U images =item * 0 to 65535 for CV_16U images =item * 0 to 1 for CV_32F images =back In case of linear transformations, the range does not matter. But in case of a non-linear transformation, an input RGB image should be normalized to the proper value range to get the correct results, for example, for RGB \rightarrow
L*u*v* transformation. For example, if you have a 32-bit floating-point image directly converted from an 8-bit image without any scaling, then it will have the 0..255 value range instead of 0..1 assumed by the function. So, before calling #cvtColor , you need first to scale the image down:
img *= 1./255;
cvtColor(img, img, COLOR_BGR2Luv);
If you use #cvtColor with 8-bit images, the conversion will have some information lost. For many applications, this will not be noticeable but it is recommended to use 32-bit images in applications that need the full range of colors or that convert an image before an operation and then convert back. If conversion adds the alpha channel, its value will set to the maximum of corresponding channel range: 255 for CV_8U, 65535 for CV_16U, 1 for CV_32F. @ref imgproc_color_conversions
Parameters:
- src
-
input image: 8-bit unsigned, 16-bit unsigned ( CV_16UC... ), or single-precision floating-point.
- dst
-
output image of the same size and depth as src.
- code
-
color space conversion code (see #ColorConversionCodes).
- dstCn
-
number of channels in the destination image; if the parameter is 0, the number of the channels is derived automatically from src and code.
See also:
cvtColor ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
cvtColorTwoPlane
Signature: ([phys] src1(l1,c1,r1); [phys] src2(l2,c2,r2); [o,phys] dst(l3,c3,r3); int [phys] code())
Converts an image from one color space to another where the source image is stored in two planes. NO BROADCASTING.
$dst = cvtColorTwoPlane($src1,$src2,$code);
This function only supports YUV420 to RGB conversion as of now.
Parameters:
- src1
-
8-bit image (#CV_8U) of the Y plane.
- src2
-
image containing interleaved U/V plane.
- dst
-
output image.
- code
-
Specifies the type of conversion. It can take any of the following values: - #COLOR_YUV2BGR_NV12 - #COLOR_YUV2RGB_NV12 - #COLOR_YUV2BGRA_NV12 - #COLOR_YUV2RGBA_NV12 - #COLOR_YUV2BGR_NV21 - #COLOR_YUV2RGB_NV21 - #COLOR_YUV2BGRA_NV21 - #COLOR_YUV2RGBA_NV21
cvtColorTwoPlane ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
demosaicing
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); int [phys] code(); int [phys] dstCn())
main function for all demosaicing processes NO BROADCASTING.
$dst = demosaicing($src,$code); # with defaults
$dst = demosaicing($src,$code,$dstCn);
The function can do the following transformations: - Demosaicing using bilinear interpolation #COLOR_BayerBG2BGR , #COLOR_BayerGB2BGR , #COLOR_BayerRG2BGR , #COLOR_BayerGR2BGR #COLOR_BayerBG2GRAY , #COLOR_BayerGB2GRAY , #COLOR_BayerRG2GRAY , #COLOR_BayerGR2GRAY - Demosaicing using Variable Number of Gradients. #COLOR_BayerBG2BGR_VNG , #COLOR_BayerGB2BGR_VNG , #COLOR_BayerRG2BGR_VNG , #COLOR_BayerGR2BGR_VNG - Edge-Aware Demosaicing. #COLOR_BayerBG2BGR_EA , #COLOR_BayerGB2BGR_EA , #COLOR_BayerRG2BGR_EA , #COLOR_BayerGR2BGR_EA - Demosaicing with alpha channel #COLOR_BayerBG2BGRA , #COLOR_BayerGB2BGRA , #COLOR_BayerRG2BGRA , #COLOR_BayerGR2BGRA
Parameters:
- src
-
input image: 8-bit unsigned or 16-bit unsigned.
- dst
-
output image of the same size and depth as src.
- code
-
Color space conversion code (see the description below).
- dstCn
-
number of channels in the destination image; if the parameter is 0, the number of the channels is derived automatically from src and code.
See also: cvtColor
demosaicing ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
matchTemplate
Signature: ([phys] image(l1,c1,r1); [phys] templ(l2,c2,r2); [o,phys] result(l3,c3,r3); int [phys] method(); [phys] mask(l5,c5,r5))
Compares a template against overlapped image regions. NO BROADCASTING.
$result = matchTemplate($image,$templ,$method); # with defaults
$result = matchTemplate($image,$templ,$method,$mask);
The function slides through image , compares the overlapped patches of size w \times h
against templ using the specified method and stores the comparison results in result . #TemplateMatchModes describes the formulae for the available comparison methods ( I
denotes image, T
template, R
result, M
the optional mask ). The summation is done over template and/or the image patch: x' = 0...w-1, y' = 0...h-1
After the function finishes the comparison, the best matches can be found as global minimums (when #TM_SQDIFF was used) or maximums (when #TM_CCORR or #TM_CCOEFF was used) using the #minMaxLoc function. In case of a color image, template summation in the numerator and each sum in the denominator is done over all of the channels and separate mean values are used for each channel. That is, the function can take a color template and a color image. The result will still be a single-channel image, which is easier to analyze. W \times H
and templ is w \times h
, then result is (W-w+1) \times (H-h+1)
.
Parameters:
- image
-
Image where the search is running. It must be 8-bit or 32-bit floating-point.
- templ
-
Searched template. It must be not greater than the source image and have the same data type.
- result
-
Map of comparison results. It must be single-channel 32-bit floating-point. If image is
- method
-
Parameter specifying the comparison method, see #TemplateMatchModes
- mask
-
Optional mask. It must have the same size as templ. It must either have the same number of channels as template or only one channel, which is then used for all template and image channels. If the data type is #CV_8U, the mask is interpreted as a binary mask, meaning only elements where mask is nonzero are used and are kept unchanged independent of the actual mask value (weight equals 1). For data tpye #CV_32F, the mask values are used as weights. The exact formulas are documented in #TemplateMatchModes.
matchTemplate ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
connectedComponentsWithAlgorithm
Signature: ([phys] image(l1,c1,r1); [o,phys] labels(l2,c2,r2); int [phys] connectivity(); int [phys] ltype(); int [phys] ccltype(); int [o,phys] res())
computes the connected components labeled image of boolean image NO BROADCASTING.
($labels,$res) = connectedComponentsWithAlgorithm($image,$connectivity,$ltype,$ccltype);
image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image. ccltype specifies the connected components labeling algorithm to use, currently Grana (BBDT) and Wu's (SAUF) @cite Wu2009 algorithms are supported, see the #ConnectedComponentsAlgorithmsTypes for details. Note that SAUF algorithm forces a row major ordering of labels while BBDT does not. This function uses parallel version of both Grana and Wu's algorithms if at least one allowed parallel framework is enabled and if the rows of the image are at least twice the number returned by #getNumberOfCPUs.
Parameters:
- image
-
the 8-bit single-channel image to be labeled
- labels
-
destination labeled image
- connectivity
-
8 or 4 for 8-way or 4-way connectivity respectively
- ltype
-
output image label type. Currently CV_32S and CV_16U are supported.
- ccltype
-
connected components algorithm type (see the #ConnectedComponentsAlgorithmsTypes).
connectedComponentsWithAlgorithm ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
connectedComponents
Signature: ([phys] image(l1,c1,r1); [o,phys] labels(l2,c2,r2); int [phys] connectivity(); int [phys] ltype(); int [o,phys] res())
NO BROADCASTING.
($labels,$res) = connectedComponents($image); # with defaults
($labels,$res) = connectedComponents($image,$connectivity,$ltype);
@overload
Parameters:
- image
-
the 8-bit single-channel image to be labeled
- labels
-
destination labeled image
- connectivity
-
8 or 4 for 8-way or 4-way connectivity respectively
- ltype
-
output image label type. Currently CV_32S and CV_16U are supported.
connectedComponents ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
connectedComponentsWithStatsWithAlgorithm
Signature: ([phys] image(l1,c1,r1); [o,phys] labels(l2,c2,r2); [o,phys] stats(l3,c3,r3); [o,phys] centroids(l4,c4,r4); int [phys] connectivity(); int [phys] ltype(); int [phys] ccltype(); int [o,phys] res())
computes the connected components labeled image of boolean image and also produces a statistics output for each label NO BROADCASTING.
($labels,$stats,$centroids,$res) = connectedComponentsWithStatsWithAlgorithm($image,$connectivity,$ltype,$ccltype);
image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image. ccltype specifies the connected components labeling algorithm to use, currently Grana's (BBDT) and Wu's (SAUF) @cite Wu2009 algorithms are supported, see the #ConnectedComponentsAlgorithmsTypes for details. Note that SAUF algorithm forces a row major ordering of labels while BBDT does not. This function uses parallel version of both Grana and Wu's algorithms (statistics included) if at least one allowed parallel framework is enabled and if the rows of the image are at least twice the number returned by #getNumberOfCPUs.
Parameters:
- image
-
the 8-bit single-channel image to be labeled
- labels
-
destination labeled image
- stats
-
statistics output for each label, including the background label. Statistics are accessed via stats(label, COLUMN) where COLUMN is one of #ConnectedComponentsTypes, selecting the statistic. The data type is CV_32S.
- centroids
-
centroid output for each label, including the background label. Centroids are accessed via centroids(label, 0) for x and centroids(label, 1) for y. The data type CV_64F.
- connectivity
-
8 or 4 for 8-way or 4-way connectivity respectively
- ltype
-
output image label type. Currently CV_32S and CV_16U are supported.
- ccltype
-
connected components algorithm type (see #ConnectedComponentsAlgorithmsTypes).
connectedComponentsWithStatsWithAlgorithm ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
connectedComponentsWithStats
Signature: ([phys] image(l1,c1,r1); [o,phys] labels(l2,c2,r2); [o,phys] stats(l3,c3,r3); [o,phys] centroids(l4,c4,r4); int [phys] connectivity(); int [phys] ltype(); int [o,phys] res())
NO BROADCASTING.
($labels,$stats,$centroids,$res) = connectedComponentsWithStats($image); # with defaults
($labels,$stats,$centroids,$res) = connectedComponentsWithStats($image,$connectivity,$ltype);
@overload
Parameters:
- image
-
the 8-bit single-channel image to be labeled
- labels
-
destination labeled image
- stats
-
statistics output for each label, including the background label. Statistics are accessed via stats(label, COLUMN) where COLUMN is one of #ConnectedComponentsTypes, selecting the statistic. The data type is CV_32S.
- centroids
-
centroid output for each label, including the background label. Centroids are accessed via centroids(label, 0) for x and centroids(label, 1) for y. The data type CV_64F.
- connectivity
-
8 or 4 for 8-way or 4-way connectivity respectively
- ltype
-
output image label type. Currently CV_32S and CV_16U are supported.
connectedComponentsWithStats ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
findContours
Signature: ([phys] image(l1,c1,r1); [o,phys] hierarchy(l3,c3,r3); int [phys] mode(); int [phys] method(); indx [phys] offset(n6); [o] vector_MatWrapper * contours)
Finds contours in a binary image. NO BROADCASTING.
($contours,$hierarchy) = findContours($image,$mode,$method); # with defaults
($contours,$hierarchy) = findContours($image,$mode,$method,$offset);
The function retrieves contours from the binary image using the algorithm @cite Suzuki85 . The contours are a useful tool for shape analysis and object detection and recognition. See squares.cpp in the OpenCV sample directory. @note Since opencv 3.2 source image is not modified by this function. @note In Python, hierarchy is nested inside a top level array. Use hierarchy[0][i] to access hierarchical elements of i-th contour.
Parameters:
- image
-
Source, an 8-bit single-channel image. Non-zero pixels are treated as 1's. Zero pixels remain 0's, so the image is treated as binary . You can use #compare, #inRange, #threshold , #adaptiveThreshold, #Canny, and others to create a binary image out of a grayscale or color one. If mode equals to #RETR_CCOMP or #RETR_FLOODFILL, the input can also be a 32-bit integer image of labels (CV_32SC1).
- contours
-
Detected contours. Each contour is stored as a vector of points (e.g. std::vector<std::vector<cv::Point> >).
- hierarchy
-
Optional output vector (e.g. std::vector<cv::Vec4i>), containing information about the image topology. It has as many elements as the number of contours. For each i-th contour contours[i], the elements hierarchy[i][0] , hierarchy[i][1] , hierarchy[i][2] , and hierarchy[i][3] are set to 0-based indices in contours of the next and previous contours at the same hierarchical level, the first child contour and the parent contour, respectively. If for the contour i there are no next, previous, parent, or nested contours, the corresponding elements of hierarchy[i] will be negative.
- mode
-
Contour retrieval mode, see #RetrievalModes
- method
-
Contour approximation method, see #ContourApproximationModes
- offset
-
Optional offset by which every contour point is shifted. This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context.
findContours ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
approxPolyDP
Signature: ([phys] curve(l1,c1,r1); [o,phys] approxCurve(l2,c2,r2); double [phys] epsilon(); byte [phys] closed())
Approximates a polygonal curve(s) with the specified precision. NO BROADCASTING.
$approxCurve = approxPolyDP($curve,$epsilon,$closed);
The function cv::approxPolyDP approximates a curve or a polygon with another curve/polygon with less vertices so that the distance between them is less or equal to the specified precision. It uses the Douglas-Peucker algorithm <http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm>
Parameters:
- curve
-
Input vector of a 2D point stored in std::vector or Mat
- approxCurve
-
Result of the approximation. The type should match the type of the input curve.
- epsilon
-
Parameter specifying the approximation accuracy. This is the maximum distance between the original curve and its approximation.
- closed
-
If true, the approximated curve is closed (its first and last vertices are connected). Otherwise, it is not closed.
approxPolyDP ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
arcLength
Signature: ([phys] curve(l1,c1,r1); byte [phys] closed(); double [o,phys] res())
Calculates a contour perimeter or a curve length.
$res = arcLength($curve,$closed);
The function computes a curve length or a closed contour perimeter.
Parameters:
- curve
-
Input vector of 2D points, stored in std::vector or Mat.
- closed
-
Flag indicating whether the curve is closed or not.
arcLength ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
boundingRect
Signature: ([phys] array(l1,c1,r1); indx [o,phys] res(n2=4))
Calculates the up-right bounding rectangle of a point set or non-zero pixels of gray-scale image.
$res = boundingRect($array);
The function calculates and returns the minimal up-right bounding rectangle for the specified point set or non-zero pixels of gray-scale image.
Parameters:
- array
-
Input gray-scale image or 2D point set, stored in std::vector or Mat.
boundingRect ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
contourArea
Signature: ([phys] contour(l1,c1,r1); byte [phys] oriented(); double [o,phys] res())
Calculates a contour area.
$res = contourArea($contour); # with defaults
$res = contourArea($contour,$oriented);
The function computes a contour area. Similarly to moments , the area is computed using the Green formula. Thus, the returned area and the number of non-zero pixels, if you draw the contour using #drawContours or #fillPoly , can be different. Also, the function will most certainly give a wrong results for contours with self-intersections. Example:
vector<Point> contour;
contour.push_back(Point2f(0, 0));
contour.push_back(Point2f(10, 0));
contour.push_back(Point2f(10, 10));
contour.push_back(Point2f(5, 4));
double area0 = contourArea(contour);
vector<Point> approx;
approxPolyDP(contour, approx, 5, true);
double area1 = contourArea(approx);
cout << "area0 =" << area0 << endl <<
"area1 =" << area1 << endl <<
"approx poly vertices" << approx.size() << endl;
Parameters:
- contour
-
Input vector of 2D points (contour vertices), stored in std::vector or Mat.
- oriented
-
Oriented area flag. If it is true, the function returns a signed area value, depending on the contour orientation (clockwise or counter-clockwise). Using this feature you can determine orientation of a contour by taking the sign of an area. By default, the parameter is false, which means that the absolute value is returned.
contourArea ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
minAreaRect
Signature: ([phys] points(l1,c1,r1); [o] RotatedRectWrapper * res)
Finds a rotated rectangle of the minimum area enclosing the input 2D point set.
$res = minAreaRect($points);
The function calculates and returns the minimum-area bounding rectangle (possibly rotated) for a specified point set. Developer should keep in mind that the returned RotatedRect can contain negative indices when data is close to the containing Mat element boundary. \<\> or Mat
Parameters:
- points
-
Input vector of 2D points, stored in std::vector
minAreaRect ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
boxPoints
Signature: ([o,phys] points(l2,c2,r2); RotatedRectWrapper * box)
Finds the four vertices of a rotated rect. Useful to draw the rotated rectangle. NO BROADCASTING.
$points = boxPoints($box);
The function finds the four vertices of a rotated rectangle. This function is useful to draw the rectangle. In C++, instead of using this function, you can directly use RotatedRect::points method. Please visit the @ref tutorial_bounding_rotated_ellipses "tutorial on Creating Bounding rotated boxes and ellipses for contours" for more information.
Parameters:
- box
-
The input rotated rectangle. It may be the output of
- points
-
The output array of four vertices of rectangles.
boxPoints ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
minEnclosingCircle
Signature: ([phys] points(l1,c1,r1); float [o,phys] center(n2=2); float [o,phys] radius())
Finds a circle of the minimum area enclosing a 2D point set.
($center,$radius) = minEnclosingCircle($points);
The function finds the minimal enclosing circle of a 2D point set using an iterative algorithm. \<\> or Mat
Parameters:
- points
-
Input vector of 2D points, stored in std::vector
- center
-
Output center of the circle.
- radius
-
Output radius of the circle.
minEnclosingCircle ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
minEnclosingTriangle
Signature: ([phys] points(l1,c1,r1); [o,phys] triangle(l2,c2,r2); double [o,phys] res())
Finds a triangle of minimum area enclosing a 2D point set and returns its area. NO BROADCASTING.
($triangle,$res) = minEnclosingTriangle($points);
The function finds a triangle of minimum area enclosing the given set of 2D points and returns its area. The output for a given 2D point set is shown in the image below. 2D points are depicted in *red* and the enclosing triangle in *yellow*. ![Sample output of the minimum enclosing triangle function](pics/minenclosingtriangle.png) The implementation of the algorithm is based on O'Rourke's @cite ORourke86 and Klee and Laskowski's @cite KleeLaskowski85 papers. O'Rourke provides a \theta(n)
algorithm for finding the minimal enclosing triangle of a 2D convex polygon with n vertices. Since the #minEnclosingTriangle function takes a 2D point set as input an additional preprocessing step of computing the convex hull of the 2D point set is required. The complexity of the #convexHull function is O(n log(n))
which is higher than \theta(n)
. Thus the overall complexity of the function is O(n log(n))
. \<\> or Mat
Parameters:
- points
-
Input vector of 2D points with depth CV_32S or CV_32F, stored in std::vector
- triangle
-
Output vector of three 2D points defining the vertices of the triangle. The depth of the OutputArray must be CV_32F.
minEnclosingTriangle ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
matchShapes
Signature: ([phys] contour1(l1,c1,r1); [phys] contour2(l2,c2,r2); int [phys] method(); double [phys] parameter(); double [o,phys] res())
Compares two shapes.
$res = matchShapes($contour1,$contour2,$method,$parameter);
The function compares two shapes. All three implemented methods use the Hu invariants (see #HuMoments)
Parameters:
- contour1
-
First contour or grayscale image.
- contour2
-
Second contour or grayscale image.
- method
-
Comparison method, see #ShapeMatchModes
- parameter
-
Method-specific parameter (not supported now).
matchShapes ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
convexHull
Signature: ([phys] points(l1,c1,r1); [o,phys] hull(l2,c2,r2); byte [phys] clockwise(); byte [phys] returnPoints())
Finds the convex hull of a point set. NO BROADCASTING.
$hull = convexHull($points); # with defaults
$hull = convexHull($points,$clockwise,$returnPoints);
The function cv::convexHull finds the convex hull of a 2D point set using the Sklansky's algorithm @cite Sklansky82 that has *O(N logN)* complexity in the current implementation. \<int\> implies returnPoints=false, std::vector\<Point\> implies returnPoints=true. @note `points` and `hull` should be different arrays, inplace processing isn't supported. Check @ref tutorial_hull "the corresponding tutorial" for more details. useful links: https://www.learnopencv.com/convex-hull-using-opencv-in-python-and-c/
Parameters:
- points
-
Input 2D point set, stored in std::vector or Mat.
- hull
-
Output convex hull. It is either an integer vector of indices or vector of points. In the first case, the hull elements are 0-based indices of the convex hull points in the original array (since the set of convex hull points is a subset of the original point set). In the second case, hull elements are the convex hull points themselves.
- clockwise
-
Orientation flag. If it is true, the output convex hull is oriented clockwise. Otherwise, it is oriented counter-clockwise. The assumed coordinate system has its X axis pointing to the right, and its Y axis pointing upwards.
- returnPoints
-
Operation flag. In case of a matrix, when the flag is true, the function returns convex hull points. Otherwise, it returns indices of the convex hull points. When the output array is std::vector, the flag is ignored, and the output depends on the type of the vector: std::vector
convexHull ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
convexityDefects
Signature: ([phys] contour(l1,c1,r1); [phys] convexhull(l2,c2,r2); [o,phys] convexityDefects(l3,c3,r3))
Finds the convexity defects of a contour. NO BROADCASTING.
$convexityDefects = convexityDefects($contour,$convexhull);
The figure below displays convexity defects of a hand contour: ![image](pics/defects.png)
Parameters:
- contour
-
Input contour.
- convexhull
-
Convex hull obtained using convexHull that should contain indices of the contour points that make the hull.
- convexityDefects
-
The output vector of convexity defects. In C++ and the new Python/Java interface each convexity defect is represented as 4-element integer vector (a.k.a. #Vec4i): (start_index, end_index, farthest_pt_index, fixpt_depth), where indices are 0-based indices in the original contour of the convexity defect beginning, end and the farthest point, and fixpt_depth is fixed-point approximation (with 8 fractional bits) of the distance between the farthest contour point and the hull. That is, to get the floating-point value of the depth will be fixpt_depth/256.0.
convexityDefects ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
isContourConvex
Signature: ([phys] contour(l1,c1,r1); byte [o,phys] res())
Tests a contour convexity.
$res = isContourConvex($contour);
The function tests whether the input contour is convex or not. The contour must be simple, that is, without self-intersections. Otherwise, the function output is undefined. \<\> or Mat
Parameters:
- contour
-
Input vector of 2D points, stored in std::vector
isContourConvex ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
intersectConvexConvex
Signature: ([phys] p1(l1,c1,r1); [phys] p2(l2,c2,r2); [o,phys] p12(l3,c3,r3); byte [phys] handleNested(); float [o,phys] res())
Finds intersection of two convex polygons NO BROADCASTING.
($p12,$res) = intersectConvexConvex($p1,$p2); # with defaults
($p12,$res) = intersectConvexConvex($p1,$p2,$handleNested);
@note intersectConvexConvex doesn't confirm that both polygons are convex and will return invalid results if they aren't.
Parameters:
- p1
-
First polygon
- p2
-
Second polygon
- p12
-
Output polygon describing the intersecting area
- handleNested
-
When true, an intersection is found if one of the polygons is fully enclosed in the other. When false, no intersection is found. If the polygons share a side or the vertex of one polygon lies on an edge of the other, they are not considered nested and an intersection will be found regardless of the value of handleNested.
Returns: Absolute value of area of intersecting polygon
intersectConvexConvex ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
fitEllipse
Signature: ([phys] points(l1,c1,r1); [o] RotatedRectWrapper * res)
Fits an ellipse around a set of 2D points.
$res = fitEllipse($points);
The function calculates the ellipse that fits (in a least-squares sense) a set of 2D points best of all. It returns the rotated rectangle in which the ellipse is inscribed. The first algorithm described by @cite Fitzgibbon95 is used. Developer should keep in mind that it is possible that the returned ellipse/rotatedRect data contains negative indices, due to the data points being close to the border of the containing Mat element. \<\> or Mat
Parameters:
- points
-
Input 2D point set, stored in std::vector
fitEllipse ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
fitEllipseAMS
Signature: ([phys] points(l1,c1,r1); [o] RotatedRectWrapper * res)
Fits an ellipse around a set of 2D points.
$res = fitEllipseAMS($points);
The function calculates the ellipse that fits a set of 2D points. It returns the rotated rectangle in which the ellipse is inscribed. The Approximate Mean Square (AMS) proposed by @cite Taubin1991 is used. For an ellipse, this basis set is \chi= \left(x^2, x y, y^2, x, y, 1\right)
, which is a set of six free coefficients A^T=\left\{A_{\text{xx}},A_{\text{xy}},A_{\text{yy}},A_x,A_y,A_0\right\}
. However, to specify an ellipse, all that is needed is five numbers; the major and minor axes lengths (a,b)
, the position (x_0,y_0)
, and the orientation \theta
. This is because the basis set includes lines, quadratics, parabolic and hyperbolic functions as well as elliptical functions as possible fits. If the fit is found to be a parabolic or hyperbolic function then the standard #fitEllipse method is used. The AMS method restricts the fit to parabolic, hyperbolic and elliptical curves by imposing the condition that A^T ( D_x^T D_x + D_y^T D_y) A = 1
where the matrices Dx
and Dy
are the partial derivatives of the design matrix D
with respect to x and y. The matrices are formed row by row applying the following to each of the points in the set: \f{align*}{ D(i,:)&=\left\{x_i^2, x_i y_i, y_i^2, x_i, y_i, 1\right\} & D_x(i,:)&=\left\{2 x_i,y_i,0,1,0,0\right\} & D_y(i,:)&=\left\{0,x_i,2 y_i,0,1,0\right\} \f} The AMS method minimizes the cost function \f{equation*}{ \epsilon ^2=\frac{ A^T D^T D A }{ A^T (D_x^T D_x + D_y^T D_y) A^T } \f} The minimum cost is found by solving the generalized eigenvalue problem. \f{equation*}{ D^T D A = \lambda \left( D_x^T D_x + D_y^T D_y\right) A \f} \<\> or Mat
Parameters:
- points
-
Input 2D point set, stored in std::vector
fitEllipseAMS ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
fitEllipseDirect
Signature: ([phys] points(l1,c1,r1); [o] RotatedRectWrapper * res)
Fits an ellipse around a set of 2D points.
$res = fitEllipseDirect($points);
The function calculates the ellipse that fits a set of 2D points. It returns the rotated rectangle in which the ellipse is inscribed. The Direct least square (Direct) method by @cite Fitzgibbon1999 is used. For an ellipse, this basis set is \chi= \left(x^2, x y, y^2, x, y, 1\right)
, which is a set of six free coefficients A^T=\left\{A_{\text{xx}},A_{\text{xy}},A_{\text{yy}},A_x,A_y,A_0\right\}
. However, to specify an ellipse, all that is needed is five numbers; the major and minor axes lengths (a,b)
, the position (x_0,y_0)
, and the orientation \theta
. This is because the basis set includes lines, quadratics, parabolic and hyperbolic functions as well as elliptical functions as possible fits. The Direct method confines the fit to ellipses by ensuring that 4 A_{xx} A_{yy}- A_{xy}^2 > 0
. The condition imposed is that 4 A_{xx} A_{yy}- A_{xy}^2=1
which satisfies the inequality and as the coefficients can be arbitrarily scaled is not overly restrictive. \f{equation*}{ \epsilon ^2= A^T D^T D A \quad \text{with} \quad A^T C A =1 \quad \text{and} \quad C=\left(\begin{matrix} 0 & 0 & 2 & 0 & 0 & 0 \\ 0 & -1 & 0 & 0 & 0 & 0 \\ 2 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 \end{matrix} \right) \f} The minimum cost is found by solving the generalized eigenvalue problem. \f{equation*}{ D^T D A = \lambda \left( C\right) A \f} The system produces only one positive eigenvalue \lambda
which is chosen as the solution with its eigenvector \mathbf{u}
. These are used to find the coefficients \f{equation*}{ A = \sqrt{\frac{1}{\mathbf{u}^T C \mathbf{u}}} \mathbf{u} \f} The scaling factor guarantees that A^T C A =1
. \<\> or Mat
Parameters:
- points
-
Input 2D point set, stored in std::vector
fitEllipseDirect ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
fitLine
Signature: ([phys] points(l1,c1,r1); [o,phys] line(l2,c2,r2); int [phys] distType(); double [phys] param(); double [phys] reps(); double [phys] aeps())
Fits a line to a 2D or 3D point set. NO BROADCASTING.
$line = fitLine($points,$distType,$param,$reps,$aeps);
The function fitLine fits a line to a 2D or 3D point set by minimizing \sum_i \rho(r_i)
where r_i
is a distance between the i^{th}
point, the line and \rho(r)
is a distance function, one of the following: =over =back The algorithm is based on the M-estimator ( <http://en.wikipedia.org/wiki/M-estimator> ) technique that iteratively fits the line using the weighted least-squares algorithm. After each iteration the weights w_i
are adjusted to be inversely proportional to \rho(r_i)
. \<\> or Mat.
Parameters:
- points
-
Input vector of 2D or 3D points, stored in std::vector
- line
-
Output line parameters. In case of 2D fitting, it should be a vector of 4 elements (like Vec4f) - (vx, vy, x0, y0), where (vx, vy) is a normalized vector collinear to the line and (x0, y0) is a point on the line. In case of 3D fitting, it should be a vector of 6 elements (like Vec6f) - (vx, vy, vz, x0, y0, z0), where (vx, vy, vz) is a normalized vector collinear to the line and (x0, y0, z0) is a point on the line.
- distType
-
Distance used by the M-estimator, see #DistanceTypes
- param
-
Numerical parameter ( C ) for some types of distances. If it is 0, an optimal value is chosen.
- reps
-
Sufficient accuracy for the radius (distance between the coordinate origin and the line).
- aeps
-
Sufficient accuracy for the angle. 0.01 would be a good default value for reps and aeps.
fitLine ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
pointPolygonTest
Signature: ([phys] contour(l1,c1,r1); float [phys] pt(n2=2); byte [phys] measureDist(); double [o,phys] res())
Performs a point-in-contour test.
$res = pointPolygonTest($contour,$pt,$measureDist);
The function determines whether the point is inside a contour, outside, or lies on an edge (or coincides with a vertex). It returns positive (inside), negative (outside), or zero (on an edge) value, correspondingly. When measureDist=false , the return value is +1, -1, and 0, respectively. Otherwise, the return value is a signed distance between the point and the nearest contour edge. See below a sample output of the function where each image pixel is tested against the contour: ![sample output](pics/pointpolygon.png)
Parameters:
- contour
-
Input contour.
- pt
-
Point tested against the contour.
- measureDist
-
If true, the function estimates the signed distance from the point to the nearest contour edge. Otherwise, the function only checks if the point is inside a contour or not.
pointPolygonTest ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
rotatedRectangleIntersection
Signature: ([o,phys] intersectingRegion(l3,c3,r3); int [o,phys] res(); RotatedRectWrapper * rect1; RotatedRectWrapper * rect2)
Finds out if there is any intersection between two rotated rectangles. NO BROADCASTING.
($intersectingRegion,$res) = rotatedRectangleIntersection($rect1,$rect2);
If there is then the vertices of the intersecting region are returned as well. Below are some examples of intersection configurations. The hatched pattern indicates the intersecting region and the red vertices are returned by the function. ![intersection examples](pics/intersection.png) \<cv::Point2f\> or cv::Mat as Mx1 of type CV_32FC2.
Parameters:
- rect1
-
First rectangle
- rect2
-
Second rectangle
- intersectingRegion
-
The output array of the vertices of the intersecting region. It returns at most 8 vertices. Stored as std::vector
Returns: One of #RectanglesIntersectTypes
rotatedRectangleIntersection ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
applyColorMap
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); int [phys] colormap())
Applies a GNU Octave/MATLAB equivalent colormap on a given image. NO BROADCASTING.
$dst = applyColorMap($src,$colormap);
Parameters:
- src
-
The source image, grayscale or colored of type CV_8UC1 or CV_8UC3.
- dst
-
The result is the colormapped source image. Note: Mat::create is called on dst.
- colormap
-
The colormap to apply, see #ColormapTypes
applyColorMap ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
applyColorMap2
Signature: ([phys] src(l1,c1,r1); [o,phys] dst(l2,c2,r2); [phys] userColor(l3,c3,r3))
Applies a user colormap on a given image. NO BROADCASTING.
$dst = applyColorMap2($src,$userColor);
Parameters:
- src
-
The source image, grayscale or colored of type CV_8UC1 or CV_8UC3.
- dst
-
The result is the colormapped source image. Note: Mat::create is called on dst.
- userColor
-
The colormap to apply of type CV_8UC1 or CV_8UC3 and size 256
applyColorMap2 ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
line
Signature: ([io,phys] img(l1,c1,r1); indx [phys] pt1(n2=2); indx [phys] pt2(n3=2); double [phys] color(n4=4); int [phys] thickness(); int [phys] lineType(); int [phys] shift())
Draws a line segment connecting two points.
line($img,$pt1,$pt2,$color); # with defaults
line($img,$pt1,$pt2,$color,$thickness,$lineType,$shift);
The function line draws the line segment between pt1 and pt2 points in the image. The line is clipped by the image boundaries. For non-antialiased lines with integer coordinates, the 8-connected or 4-connected Bresenham algorithm is used. Thick lines are drawn with rounding endings. Antialiased lines are drawn using Gaussian filtering.
Parameters:
- img
-
Image.
- pt1
-
First point of the line segment.
- pt2
-
Second point of the line segment.
- color
-
Line color.
- thickness
-
Line thickness.
- lineType
-
Type of the line. See #LineTypes.
- shift
-
Number of fractional bits in the point coordinates.
line ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
arrowedLine
Signature: ([io,phys] img(l1,c1,r1); indx [phys] pt1(n2=2); indx [phys] pt2(n3=2); double [phys] color(n4=4); int [phys] thickness(); int [phys] line_type(); int [phys] shift(); double [phys] tipLength())
Draws an arrow segment pointing from the first point to the second one.
arrowedLine($img,$pt1,$pt2,$color); # with defaults
arrowedLine($img,$pt1,$pt2,$color,$thickness,$line_type,$shift,$tipLength);
The function cv::arrowedLine draws an arrow between pt1 and pt2 points in the image. See also #line.
Parameters:
- img
-
Image.
- pt1
-
The point the arrow starts from.
- pt2
-
The point the arrow points to.
- color
-
Line color.
- thickness
-
Line thickness.
- line_type
-
Type of the line. See #LineTypes
- shift
-
Number of fractional bits in the point coordinates.
- tipLength
-
The length of the arrow tip in relation to the arrow length
arrowedLine ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
rectangle
Signature: ([io,phys] img(l1,c1,r1); indx [phys] pt1(n2=2); indx [phys] pt2(n3=2); double [phys] color(n4=4); int [phys] thickness(); int [phys] lineType(); int [phys] shift())
Draws a simple, thick, or filled up-right rectangle.
rectangle($img,$pt1,$pt2,$color); # with defaults
rectangle($img,$pt1,$pt2,$color,$thickness,$lineType,$shift);
The function cv::rectangle draws a rectangle outline or a filled rectangle whose two opposite corners are pt1 and pt2.
Parameters:
- img
-
Image.
- pt1
-
Vertex of the rectangle.
- pt2
-
Vertex of the rectangle opposite to pt1 .
- color
-
Rectangle color or brightness (grayscale image).
- thickness
-
Thickness of lines that make up the rectangle. Negative values, like #FILLED, mean that the function has to draw a filled rectangle.
- lineType
-
Type of the line. See #LineTypes
- shift
-
Number of fractional bits in the point coordinates.
rectangle ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
rectangle2
Signature: ([io,phys] img(l1,c1,r1); indx [phys] rec(n2=4); double [phys] color(n3=4); int [phys] thickness(); int [phys] lineType(); int [phys] shift())
rectangle2($img,$rec,$color); # with defaults
rectangle2($img,$rec,$color,$thickness,$lineType,$shift);
@overload use `rec` parameter as alternative specification of the drawn rectangle: `r.tl() and r.br()-Point(1,1)` are opposite corners
rectangle2 ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
circle
Signature: ([io,phys] img(l1,c1,r1); indx [phys] center(n2=2); int [phys] radius(); double [phys] color(n4=4); int [phys] thickness(); int [phys] lineType(); int [phys] shift())
Draws a circle.
circle($img,$center,$radius,$color); # with defaults
circle($img,$center,$radius,$color,$thickness,$lineType,$shift);
The function cv::circle draws a simple or filled circle with a given center and radius.
Parameters:
- img
-
Image where the circle is drawn.
- center
-
Center of the circle.
- radius
-
Radius of the circle.
- color
-
Circle color.
- thickness
-
Thickness of the circle outline, if positive. Negative values, like #FILLED, mean that a filled circle is to be drawn.
- lineType
-
Type of the circle boundary. See #LineTypes
- shift
-
Number of fractional bits in the coordinates of the center and in the radius value.
circle ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
ellipse
Signature: ([io,phys] img(l1,c1,r1); indx [phys] center(n2=2); indx [phys] axes(n3=2); double [phys] angle(); double [phys] startAngle(); double [phys] endAngle(); double [phys] color(n7=4); int [phys] thickness(); int [phys] lineType(); int [phys] shift())
Draws a simple or thick elliptic arc or fills an ellipse sector.
ellipse($img,$center,$axes,$angle,$startAngle,$endAngle,$color); # with defaults
ellipse($img,$center,$axes,$angle,$startAngle,$endAngle,$color,$thickness,$lineType,$shift);
The function cv::ellipse with more parameters draws an ellipse outline, a filled ellipse, an elliptic arc, or a filled ellipse sector. The drawing code uses general parametric form. A piecewise-linear curve is used to approximate the elliptic arc boundary. If you need more control of the ellipse rendering, you can retrieve the curve using #ellipse2Poly and then render it with #polylines or fill it with #fillPoly. If you use the first variant of the function and want to draw the whole ellipse, not an arc, pass `startAngle=0` and `endAngle=360`. If `startAngle` is greater than `endAngle`, they are swapped. The figure below explains the meaning of the parameters to draw the blue arc. ![Parameters of Elliptic Arc](pics/ellipse.svg)
Parameters:
- img
-
Image.
- center
-
Center of the ellipse.
- axes
-
Half of the size of the ellipse main axes.
- angle
-
Ellipse rotation angle in degrees.
- startAngle
-
Starting angle of the elliptic arc in degrees.
- endAngle
-
Ending angle of the elliptic arc in degrees.
- color
-
Ellipse color.
- thickness
-
Thickness of the ellipse arc outline, if positive. Otherwise, this indicates that a filled ellipse sector is to be drawn.
- lineType
-
Type of the ellipse boundary. See #LineTypes
- shift
-
Number of fractional bits in the coordinates of the center and values of axes.
ellipse ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
ellipse2
Signature: ([io,phys] img(l1,c1,r1); double [phys] color(n3=4); int [phys] thickness(); int [phys] lineType(); RotatedRectWrapper * box)
ellipse2($img,$box,$color); # with defaults
ellipse2($img,$box,$color,$thickness,$lineType);
@overload
Parameters:
- img
-
Image.
- box
-
Alternative ellipse representation via RotatedRect. This means that the function draws an ellipse inscribed in the rotated rectangle.
- color
-
Ellipse color.
- thickness
-
Thickness of the ellipse arc outline, if positive. Otherwise, this indicates that a filled ellipse sector is to be drawn.
- lineType
-
Type of the ellipse boundary. See #LineTypes
ellipse2 ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
drawMarker
Signature: ([io,phys] img(l1,c1,r1); indx [phys] position(n2=2); double [phys] color(n3=4); int [phys] markerType(); int [phys] markerSize(); int [phys] thickness(); int [phys] line_type())
Draws a marker on a predefined position in an image.
drawMarker($img,$position,$color); # with defaults
drawMarker($img,$position,$color,$markerType,$markerSize,$thickness,$line_type);
The function cv::drawMarker draws a marker on a given position in the image. For the moment several marker types are supported, see #MarkerTypes for more information.
Parameters:
- img
-
Image.
- position
-
The point where the crosshair is positioned.
- color
-
Line color.
- markerType
-
The specific type of marker you want to use, see #MarkerTypes
- thickness
-
Line thickness.
- line_type
-
Type of the line, See #LineTypes
- markerSize
-
The length of the marker axis [default = 20 pixels]
drawMarker ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
fillConvexPoly
Signature: ([io,phys] img(l1,c1,r1); [phys] points(l2,c2,r2); double [phys] color(n3=4); int [phys] lineType(); int [phys] shift())
Fills a convex polygon.
fillConvexPoly($img,$points,$color); # with defaults
fillConvexPoly($img,$points,$color,$lineType,$shift);
The function cv::fillConvexPoly draws a filled convex polygon. This function is much faster than the function #fillPoly . It can fill not only convex polygons but any monotonic polygon without self-intersections, that is, a polygon whose contour intersects every horizontal line (scan line) twice at the most (though, its top-most and/or the bottom edge could be horizontal).
Parameters:
- img
-
Image.
- points
-
Polygon vertices.
- color
-
Polygon color.
- lineType
-
Type of the polygon boundaries. See #LineTypes
- shift
-
Number of fractional bits in the vertex coordinates.
fillConvexPoly ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
fillPoly
Signature: ([io,phys] img(l1,c1,r1); double [phys] color(n3=4); int [phys] lineType(); int [phys] shift(); indx [phys] offset(n6); vector_MatWrapper * pts)
Fills the area bounded by one or more polygons.
fillPoly($img,$pts,$color); # with defaults
fillPoly($img,$pts,$color,$lineType,$shift,$offset);
The function cv::fillPoly fills an area bounded by several polygonal contours. The function can fill complex areas, for example, areas with holes, contours with self-intersections (some of their parts), and so forth.
Parameters:
- img
-
Image.
- pts
-
Array of polygons where each polygon is represented as an array of points.
- color
-
Polygon color.
- lineType
-
Type of the polygon boundaries. See #LineTypes
- shift
-
Number of fractional bits in the vertex coordinates.
- offset
-
Optional offset of all points of the contours.
fillPoly ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
polylines
Signature: ([io,phys] img(l1,c1,r1); byte [phys] isClosed(); double [phys] color(n4=4); int [phys] thickness(); int [phys] lineType(); int [phys] shift(); vector_MatWrapper * pts)
Draws several polygonal curves.
polylines($img,$pts,$isClosed,$color); # with defaults
polylines($img,$pts,$isClosed,$color,$thickness,$lineType,$shift);
The function cv::polylines draws one or more polygonal curves.
Parameters:
- img
-
Image.
- pts
-
Array of polygonal curves.
- isClosed
-
Flag indicating whether the drawn polylines are closed or not. If they are closed, the function draws a line from the last vertex of each curve to its first vertex.
- color
-
Polyline color.
- thickness
-
Thickness of the polyline edges.
- lineType
-
Type of the line segments. See #LineTypes
- shift
-
Number of fractional bits in the vertex coordinates.
polylines ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
drawContours
Signature: ([io,phys] image(l1,c1,r1); int [phys] contourIdx(); double [phys] color(n4=4); int [phys] thickness(); int [phys] lineType(); [phys] hierarchy(l7,c7,r7); int [phys] maxLevel(); indx [phys] offset(n9); vector_MatWrapper * contours)
Draws contours outlines or filled contours.
drawContours($image,$contours,$contourIdx,$color); # with defaults
drawContours($image,$contours,$contourIdx,$color,$thickness,$lineType,$hierarchy,$maxLevel,$offset);
The function draws contour outlines in the image if \texttt{thickness} \ge 0
or fills the area bounded by the contours if \texttt{thickness}<0
. The example below shows how to retrieve connected components from the binary image and label them: : @include snippets/imgproc_drawContours.cpp \texttt{offset}=(dx,dy)
. @note When thickness=#FILLED, the function is designed to handle connected components with holes correctly even when no hierarchy data is provided. This is done by analyzing all the outlines together using even-odd rule. This may give incorrect results if you have a joint collection of separately retrieved contours. In order to solve this problem, you need to call #drawContours separately for each sub-group of contours, or iterate over the collection using contourIdx parameter.
Parameters:
- image
-
Destination image.
- contours
-
All the input contours. Each contour is stored as a point vector.
- contourIdx
-
Parameter indicating a contour to draw. If it is negative, all the contours are drawn.
- color
-
Color of the contours.
- thickness
-
Thickness of lines the contours are drawn with. If it is negative (for example, thickness=#FILLED ), the contour interiors are drawn.
- lineType
-
Line connectivity. See #LineTypes
- hierarchy
-
Optional information about hierarchy. It is only needed if you want to draw only some of the contours (see maxLevel ).
- maxLevel
-
Maximal level for drawn contours. If it is 0, only the specified contour is drawn. If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This parameter is only taken into account when there is hierarchy available.
- offset
-
Optional contour shift parameter. Shift all the drawn contours by the specified
drawContours ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
clipLine
Signature: (indx [phys] imgRect(n1=4); indx [o,phys] pt1(n2=2); indx [o,phys] pt2(n3=2); byte [o,phys] res())
($pt1,$pt2,$res) = clipLine($imgRect);
@overload
Parameters:
- imgRect
-
Image rectangle.
- pt1
-
First line point.
- pt2
-
Second line point.
clipLine ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
ellipse2Poly
Signature: (indx [phys] center(n1=2); indx [phys] axes(n2=2); int [phys] angle(); int [phys] arcStart(); int [phys] arcEnd(); int [phys] delta(); indx [o,phys] pts(n7=2,n7d0))
Approximates an elliptic arc with a polyline. NO BROADCASTING.
$pts = ellipse2Poly($center,$axes,$angle,$arcStart,$arcEnd,$delta);
The function ellipse2Poly computes the vertices of a polyline that approximates the specified elliptic arc. It is used by #ellipse. If `arcStart` is greater than `arcEnd`, they are swapped.
Parameters:
- center
-
Center of the arc.
- axes
-
Half of the size of the ellipse main axes. See #ellipse for details.
- angle
-
Rotation angle of the ellipse in degrees. See #ellipse for details.
- arcStart
-
Starting angle of the elliptic arc in degrees.
- arcEnd
-
Ending angle of the elliptic arc in degrees.
- delta
-
Angle between the subsequent polyline vertices. It defines the approximation accuracy.
- pts
-
Output vector of polyline vertices.
ellipse2Poly ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
putText
Signature: ([io,phys] img(l1,c1,r1); indx [phys] org(n3=2); int [phys] fontFace(); double [phys] fontScale(); double [phys] color(n6=4); int [phys] thickness(); int [phys] lineType(); byte [phys] bottomLeftOrigin(); StringWrapper* text)
Draws a text string.
putText($img,$text,$org,$fontFace,$fontScale,$color); # with defaults
putText($img,$text,$org,$fontFace,$fontScale,$color,$thickness,$lineType,$bottomLeftOrigin);
The function cv::putText renders the specified text string in the image. Symbols that cannot be rendered using the specified font are replaced by question marks. See #getTextSize for a text rendering code example.
Parameters:
- img
-
Image.
- text
-
Text string to be drawn.
- org
-
Bottom-left corner of the text string in the image.
- fontFace
-
Font type, see #HersheyFonts.
- fontScale
-
Font scale factor that is multiplied by the font-specific base size.
- color
-
Text color.
- thickness
-
Thickness of the lines used to draw a text.
- lineType
-
Line type. See #LineTypes
- bottomLeftOrigin
-
When true, the image data origin is at the bottom-left corner. Otherwise, it is at the top-left corner.
putText ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
getTextSize
Signature: (int [phys] fontFace(); double [phys] fontScale(); int [phys] thickness(); int [o,phys] baseLine(); indx [o,phys] res(n6=2); StringWrapper* text)
Calculates the width and height of a text string.
($baseLine,$res) = getTextSize($text,$fontFace,$fontScale,$thickness);
The function cv::getTextSize calculates and returns the size of a box that contains the specified text. That is, the following code renders some text, the tight box surrounding it, and the baseline: :
String text = "Funny text inside the box";
int fontFace = FONT_HERSHEY_SCRIPT_SIMPLEX;
double fontScale = 2;
int thickness = 3;
Mat img(600, 800, CV_8UC3, Scalar::all(0));
int baseline=0;
Size textSize = getTextSize(text, fontFace,
fontScale, thickness, &baseline);
baseline += thickness;
// center the text
Point textOrg((img.cols - textSize.width)/2,
(img.rows + textSize.height)/2);
// draw the box
rectangle(img, textOrg + Point(0, baseline),
textOrg + Point(textSize.width, -textSize.height),
Scalar(0,0,255));
// ... and the baseline first
line(img, textOrg + Point(0, thickness),
textOrg + Point(textSize.width, thickness),
Scalar(0, 0, 255));
// then put the text itself
putText(img, text, textOrg, fontFace, fontScale,
Scalar::all(255), thickness, 8);
@param[out] baseLine y-coordinate of the baseline relative to the bottom-most text point.
Parameters:
- text
-
Input text string.
- fontFace
-
Font to use, see #HersheyFonts.
- fontScale
-
Font scale factor that is multiplied by the font-specific base size.
- thickness
-
Thickness of lines used to render the text. See #putText for details.
Returns: The size of a box that contains the specified text.
See also: putText
getTextSize ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
getFontScaleFromHeight
Calculates the font-specific size to use to achieve a given height in pixels.
$res = getFontScaleFromHeight($fontFace,$pixelHeight); # with defaults
$res = getFontScaleFromHeight($fontFace,$pixelHeight,$thickness);
Parameters:
- fontFace
-
Font to use, see cv::HersheyFonts.
- pixelHeight
-
Pixel height to compute the fontScale for
- thickness
-
Thickness of lines used to render the text.See putText for details.
Returns: The fontSize to use for cv::putText
See also: cv::putText
METHODS for PDL::OpenCV::CLAHE
Base class for Contrast Limited Adaptive Histogram Equalization.
Subclass of PDL::OpenCV::Algorithm
CLAHE_new
Signature: (double [phys] clipLimit(); indx [phys] tileGridSize(n3=2); char * klass; [o] CLAHEWrapper * res)
Creates a smart pointer to a cv::CLAHE class and initializes it.
$obj = PDL::OpenCV::CLAHE->new; # with defaults
$obj = PDL::OpenCV::CLAHE->new($clipLimit,$tileGridSize);
Parameters:
- clipLimit
-
Threshold for contrast limiting.
- tileGridSize
-
Size of grid for histogram equalization. Input image will be divided into equally sized rectangular tiles. tileGridSize defines the number of tiles in row and column.
CLAHE_new ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
CLAHE_apply
Signature: ([phys] src(l2,c2,r2); [o,phys] dst(l3,c3,r3); CLAHEWrapper * self)
Equalizes the histogram of a grayscale image using Contrast Limited Adaptive Histogram Equalization. NO BROADCASTING.
$dst = $obj->apply($src);
Parameters:
- src
-
Source image of type CV_8UC1 or CV_16UC1.
- dst
-
Destination image.
CLAHE_apply ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
setClipLimit
Sets threshold for contrast limiting.
$obj->setClipLimit($clipLimit);
Parameters:
- clipLimit
-
threshold value.
getClipLimit
$res = $obj->getClipLimit;
CLAHE_setTilesGridSize
Signature: (indx [phys] tileGridSize(n2=2); CLAHEWrapper * self)
Sets size of grid for histogram equalization. Input image will be divided into equally sized rectangular tiles.
$obj->setTilesGridSize($tileGridSize);
Parameters:
- tileGridSize
-
defines the number of tiles in row and column.
CLAHE_setTilesGridSize ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
CLAHE_getTilesGridSize
Signature: (indx [o,phys] res(n2=2); CLAHEWrapper * self)
$res = $obj->getTilesGridSize;
CLAHE_getTilesGridSize ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
collectGarbage
$obj->collectGarbage;
METHODS for PDL::OpenCV::GeneralizedHough
finds arbitrary template in the grayscale image using Generalized Hough Transform
Subclass of PDL::OpenCV::Algorithm
GeneralizedHough_setTemplate
Signature: ([phys] templ(l2,c2,r2); indx [phys] templCenter(n3=2); GeneralizedHoughWrapper * self)
$obj->setTemplate($templ); # with defaults
$obj->setTemplate($templ,$templCenter);
GeneralizedHough_setTemplate ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
GeneralizedHough_setTemplate2
Signature: ([phys] edges(l2,c2,r2); [phys] dx(l3,c3,r3); [phys] dy(l4,c4,r4); indx [phys] templCenter(n5=2); GeneralizedHoughWrapper * self)
$obj->setTemplate2($edges,$dx,$dy); # with defaults
$obj->setTemplate2($edges,$dx,$dy,$templCenter);
GeneralizedHough_setTemplate2 ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
GeneralizedHough_detect
Signature: ([phys] image(l2,c2,r2); [o,phys] positions(l3,c3,r3); [o,phys] votes(l4,c4,r4); GeneralizedHoughWrapper * self)
NO BROADCASTING.
($positions,$votes) = $obj->detect($image);
GeneralizedHough_detect ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
GeneralizedHough_detect2
Signature: ([phys] edges(l2,c2,r2); [phys] dx(l3,c3,r3); [phys] dy(l4,c4,r4); [o,phys] positions(l5,c5,r5); [o,phys] votes(l6,c6,r6); GeneralizedHoughWrapper * self)
NO BROADCASTING.
($positions,$votes) = $obj->detect2($edges,$dx,$dy);
GeneralizedHough_detect2 ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
setCannyLowThresh
$obj->setCannyLowThresh($cannyLowThresh);
getCannyLowThresh
$res = $obj->getCannyLowThresh;
setCannyHighThresh
$obj->setCannyHighThresh($cannyHighThresh);
getCannyHighThresh
$res = $obj->getCannyHighThresh;
setMinDist
$obj->setMinDist($minDist);
getMinDist
$res = $obj->getMinDist;
setDp
$obj->setDp($dp);
getDp
$res = $obj->getDp;
setMaxBufferSize
$obj->setMaxBufferSize($maxBufferSize);
getMaxBufferSize
$res = $obj->getMaxBufferSize;
METHODS for PDL::OpenCV::GeneralizedHoughBallard
finds arbitrary template in the grayscale image using Generalized Hough Transform
Detects position only without translation and rotation @cite Ballard1981 .
Subclass of PDL::OpenCV::GeneralizedHough
new
Creates a smart pointer to a cv::GeneralizedHoughBallard class and initializes it.
$obj = PDL::OpenCV::GeneralizedHoughBallard->new;
setLevels
$obj->setLevels($levels);
getLevels
$res = $obj->getLevels;
setVotesThreshold
$obj->setVotesThreshold($votesThreshold);
getVotesThreshold
$res = $obj->getVotesThreshold;
METHODS for PDL::OpenCV::GeneralizedHoughGuil
finds arbitrary template in the grayscale image using Generalized Hough Transform
Detects position, translation and rotation @cite Guil1999 .
Subclass of PDL::OpenCV::GeneralizedHough
new
Creates a smart pointer to a cv::GeneralizedHoughGuil class and initializes it.
$obj = PDL::OpenCV::GeneralizedHoughGuil->new;
setXi
$obj->setXi($xi);
getXi
$res = $obj->getXi;
setLevels
$obj->setLevels($levels);
getLevels
$res = $obj->getLevels;
setAngleEpsilon
$obj->setAngleEpsilon($angleEpsilon);
getAngleEpsilon
$res = $obj->getAngleEpsilon;
setMinAngle
$obj->setMinAngle($minAngle);
getMinAngle
$res = $obj->getMinAngle;
setMaxAngle
$obj->setMaxAngle($maxAngle);
getMaxAngle
$res = $obj->getMaxAngle;
setAngleStep
$obj->setAngleStep($angleStep);
getAngleStep
$res = $obj->getAngleStep;
setAngleThresh
$obj->setAngleThresh($angleThresh);
getAngleThresh
$res = $obj->getAngleThresh;
setMinScale
$obj->setMinScale($minScale);
getMinScale
$res = $obj->getMinScale;
setMaxScale
$obj->setMaxScale($maxScale);
getMaxScale
$res = $obj->getMaxScale;
setScaleStep
$obj->setScaleStep($scaleStep);
getScaleStep
$res = $obj->getScaleStep;
setScaleThresh
$obj->setScaleThresh($scaleThresh);
getScaleThresh
$res = $obj->getScaleThresh;
setPosThresh
$obj->setPosThresh($posThresh);
getPosThresh
$res = $obj->getPosThresh;
METHODS for PDL::OpenCV::LineSegmentDetector
Line segment detector class
following the algorithm described at @cite Rafael12 . @note Implementation has been removed from OpenCV version 3.4.6 to 3.4.15 and version 4.1.0 to 4.5.3 due original code license conflict. restored again after [Computation of a NFA](https://github.com/rafael-grompone-von-gioi/binomial_nfa) code published under the MIT license.
Subclass of PDL::OpenCV::Algorithm
new
Creates a smart pointer to a LineSegmentDetector object and initializes it.
$obj = PDL::OpenCV::LineSegmentDetector->new; # with defaults
$obj = PDL::OpenCV::LineSegmentDetector->new($refine,$scale,$sigma_scale,$quant,$ang_th,$log_eps,$density_th,$n_bins);
The LineSegmentDetector algorithm is defined using the standard values. Only advanced users may want to edit those, as to tailor it for their own application. \> log_eps. Used only when advance refinement is chosen.
Parameters:
- refine
-
The way found lines will be refined, see #LineSegmentDetectorModes
- scale
-
The scale of the image that will be used to find the lines. Range (0..1].
- sigma_scale
-
Sigma for Gaussian filter. It is computed as sigma = sigma_scale/scale.
- quant
-
Bound to the quantization error on the gradient norm.
- ang_th
-
Gradient angle tolerance in degrees.
- log_eps
-
Detection threshold: -log10(NFA)
- density_th
-
Minimal density of aligned region points in the enclosing rectangle.
- n_bins
-
Number of bins in pseudo-ordering of gradient modulus.
LineSegmentDetector_detect
Signature: ([phys] image(l2,c2,r2); [o,phys] lines(l3,c3,r3); [o,phys] width(l4,c4,r4); [o,phys] prec(l5,c5,r5); [o,phys] nfa(l6,c6,r6); LineSegmentDetectorWrapper * self)
Finds lines in the input image. NO BROADCASTING.
($lines,$width,$prec,$nfa) = $obj->detect($image);
This is the output of the default parameters of the algorithm on the above shown image. ![image](pics/building_lsd.png) \>detect(image(roi), lines, ...); lines += Scalar(roi.x, roi.y, roi.x, roi.y);`
Parameters:
- image
-
A grayscale (CV_8UC1) input image. If only a roi needs to be selected, use: `lsd_ptr-
- lines
-
A vector of Vec4f elements specifying the beginning and ending point of a line. Where Vec4f is (x1, y1, x2, y2), point 1 is the start, point 2 - end. Returned lines are strictly oriented depending on the gradient.
- width
-
Vector of widths of the regions, where the lines are found. E.g. Width of line.
- prec
-
Vector of precisions with which the lines are found.
- nfa
-
Vector containing number of false alarms in the line region, with precision of 10%. The bigger the value, logarithmically better the detection. - -1 corresponds to 10 mean false alarms - 0 corresponds to 1 mean false alarm - 1 corresponds to 0.1 mean false alarms This vector will be calculated only when the objects type is #LSD_REFINE_ADV.
LineSegmentDetector_detect ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
LineSegmentDetector_drawSegments
Signature: ([io,phys] image(l2,c2,r2); [phys] lines(l3,c3,r3); LineSegmentDetectorWrapper * self)
Draws the line segments on a given image.
$obj->drawSegments($image,$lines);
Parameters:
- image
-
The image, where the lines will be drawn. Should be bigger or equal to the image, where the lines were found.
- lines
-
A vector of the lines that needed to be drawn.
LineSegmentDetector_drawSegments ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
LineSegmentDetector_compareSegments
Signature: (indx [phys] size(n2=2); [phys] lines1(l3,c3,r3); [phys] lines2(l4,c4,r4); [io,phys] image(l5,c5,r5); int [o,phys] res(); LineSegmentDetectorWrapper * self)
Draws two groups of lines in blue and red, counting the non overlapping (mismatching) pixels.
$res = $obj->compareSegments($size,$lines1,$lines2); # with defaults
$res = $obj->compareSegments($size,$lines1,$lines2,$image);
Parameters:
- size
-
The size of the image, where lines1 and lines2 were found.
- lines1
-
The first group of lines that needs to be drawn. It is visualized in blue color.
- lines2
-
The second group of lines. They visualized in red color.
- image
-
Optional image, where the lines will be drawn. The image should be color(3-channel) in order for lines1 and lines2 to be drawn in the above mentioned colors.
LineSegmentDetector_compareSegments ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
METHODS for PDL::OpenCV::Subdiv2D
new
$obj = PDL::OpenCV::Subdiv2D->new;
creates an empty Subdiv2D object. To create a new empty Delaunay subdivision you need to use the #initDelaunay function.
Subdiv2D_new2
Signature: (indx [phys] rect(n2=4); char * klass; [o] Subdiv2DWrapper * res)
$obj = PDL::OpenCV::Subdiv2D->new2($rect);
@overload The function creates an empty Delaunay subdivision where 2D points can be added using the function insert() . All of the points to be added must be within the specified rectangle, otherwise a runtime error is raised.
Parameters:
- rect
-
Rectangle that includes all of the 2D points that are to be added to the subdivision.
Subdiv2D_new2 ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
Subdiv2D_initDelaunay
Signature: (indx [phys] rect(n2=4); Subdiv2DWrapper * self)
Creates a new empty Delaunay subdivision
$obj->initDelaunay($rect);
Parameters:
- rect
-
Rectangle that includes all of the 2D points that are to be added to the subdivision.
Subdiv2D_initDelaunay ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
Subdiv2D_insert
Signature: (float [phys] pt(n2=2); int [o,phys] res(); Subdiv2DWrapper * self)
Insert a single point into a Delaunay triangulation.
$res = $obj->insert($pt);
The function inserts a single point into a subdivision and modifies the subdivision topology appropriately. If a point with the same coordinates exists already, no new point is added. @note If the point is outside of the triangulation specified rect a runtime error is raised.
Parameters:
- pt
-
Point to insert.
Returns: the ID of the point.
Subdiv2D_insert ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
Subdiv2D_insert2
Signature: (float [phys] ptvec(n2=2,n2d0); Subdiv2DWrapper * self)
Insert multiple points into a Delaunay triangulation.
$obj->insert2($ptvec);
The function inserts a vector of points into a subdivision and modifies the subdivision topology appropriately.
Parameters:
- ptvec
-
Points to insert.
Subdiv2D_insert2 ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
Subdiv2D_locate
Signature: (float [phys] pt(n2=2); int [o,phys] edge(); int [o,phys] vertex(); int [o,phys] res(); Subdiv2DWrapper * self)
Returns the location of a point within a Delaunay triangulation.
($edge,$vertex,$res) = $obj->locate($pt);
The function locates the input point within the subdivision and gives one of the triangle edges or vertices.
Parameters:
- pt
-
Point to locate.
- edge
-
Output edge that the point belongs to or is located to the right of it.
- vertex
-
Optional output vertex the input point coincides with.
Returns: an integer which specify one of the following five cases for point location: - The point falls into some facet. The function returns #PTLOC_INSIDE and edge will contain one of edges of the facet. - The point falls onto the edge. The function returns #PTLOC_ON_EDGE and edge will contain this edge. - The point coincides with one of the subdivision vertices. The function returns #PTLOC_VERTEX and vertex will contain a pointer to the vertex. - The point is outside the subdivision reference rectangle. The function returns #PTLOC_OUTSIDE_RECT and no pointers are filled. - One of input arguments is invalid. A runtime error is raised or, if silent or "parent" error processing mode is selected, #PTLOC_ERROR is returned.
Subdiv2D_locate ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
Subdiv2D_findNearest
Signature: (float [phys] pt(n2=2); float [o,phys] nearestPt(n3=2); int [o,phys] res(); Subdiv2DWrapper * self)
Finds the subdivision vertex closest to the given point.
($nearestPt,$res) = $obj->findNearest($pt);
The function is another function that locates the input point within the subdivision. It finds the subdivision vertex that is the closest to the input point. It is not necessarily one of vertices of the facet containing the input point, though the facet (located using locate() ) is used as a starting point.
Parameters:
- pt
-
Input point.
- nearestPt
-
Output subdivision vertex point.
Returns: vertex ID.
Subdiv2D_findNearest ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
Subdiv2D_getEdgeList
Signature: (float [o,phys] edgeList(n2=4,n2d0); Subdiv2DWrapper * self)
Returns a list of all edges. NO BROADCASTING.
$edgeList = $obj->getEdgeList;
The function gives each edge as a 4 numbers vector, where each two are one of the edge vertices. i.e. org_x = v[0], org_y = v[1], dst_x = v[2], dst_y = v[3].
Parameters:
- edgeList
-
Output vector.
Subdiv2D_getEdgeList ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
Subdiv2D_getLeadingEdgeList
Signature: (int [o,phys] leadingEdgeList(n2d0); Subdiv2DWrapper * self)
Returns a list of the leading edge ID connected to each triangle. NO BROADCASTING.
$leadingEdgeList = $obj->getLeadingEdgeList;
The function gives one edge ID for each triangle.
Parameters:
- leadingEdgeList
-
Output vector.
Subdiv2D_getLeadingEdgeList ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
Subdiv2D_getTriangleList
Signature: (float [o,phys] triangleList(n2=6,n2d0); Subdiv2DWrapper * self)
Returns a list of all triangles. NO BROADCASTING.
$triangleList = $obj->getTriangleList;
The function gives each triangle as a 6 numbers vector, where each two are one of the triangle vertices. i.e. p1_x = v[0], p1_y = v[1], p2_x = v[2], p2_y = v[3], p3_x = v[4], p3_y = v[5].
Parameters:
- triangleList
-
Output vector.
Subdiv2D_getTriangleList ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
Subdiv2D_getVoronoiFacetList
Signature: (int [phys] idx(n2d0); float [o,phys] facetCenters(n4=2,n4d0); Subdiv2DWrapper * self; [o] vector_vector_Point2fWrapper * facetList)
Returns a list of all Voronoi facets. NO BROADCASTING.
($facetList,$facetCenters) = $obj->getVoronoiFacetList($idx);
Parameters:
- idx
-
Vector of vertices IDs to consider. For all vertices you can pass empty vector.
- facetList
-
Output vector of the Voronoi facets.
- facetCenters
-
Output vector of the Voronoi facets center points.
Subdiv2D_getVoronoiFacetList ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
Subdiv2D_getVertex
Signature: (int [phys] vertex(); int [o,phys] firstEdge(); float [o,phys] res(n4=2); Subdiv2DWrapper * self)
Returns vertex location from vertex ID.
($firstEdge,$res) = $obj->getVertex($vertex);
Parameters:
- vertex
-
vertex ID.
- firstEdge
-
Optional. The first edge ID which is connected to the vertex.
Returns: vertex (x,y)
Subdiv2D_getVertex ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
getEdge
Returns one of the edges related to the given edge.
$res = $obj->getEdge($edge,$nextEdgeType);
![sample output](pics/quadedge.png)
Parameters:
- edge
-
Subdivision edge ID.
- nextEdgeType
-
Parameter specifying which of the related edges to return. The following values are possible: - NEXT_AROUND_ORG next around the edge origin ( eOnext on the picture below if e is the input edge) - NEXT_AROUND_DST next around the edge vertex ( eDnext ) - PREV_AROUND_ORG previous around the edge origin (reversed eRnext ) - PREV_AROUND_DST previous around the edge destination (reversed eLnext ) - NEXT_AROUND_LEFT next around the left facet ( eLnext ) - NEXT_AROUND_RIGHT next around the right facet ( eRnext ) - PREV_AROUND_LEFT previous around the left facet (reversed eOnext ) - PREV_AROUND_RIGHT previous around the right facet (reversed eDnext )
Returns: edge ID related to the input edge.
nextEdge
Returns next edge around the edge origin.
$res = $obj->nextEdge($edge);
Parameters:
- edge
-
Subdivision edge ID.
Returns: an integer which is next edge ID around the edge origin: eOnext on the picture above if e is the input edge).
rotateEdge
Returns another edge of the same quad-edge.
$res = $obj->rotateEdge($edge,$rotate);
Parameters:
- edge
-
Subdivision edge ID.
- rotate
-
Parameter specifying which of the edges of the same quad-edge as the input one to return. The following values are possible: - 0 - the input edge ( e on the picture below if e is the input edge) - 1 - the rotated edge ( eRot ) - 2 - the reversed edge (reversed e (in green)) - 3 - the reversed rotated edge (reversed eRot (in green))
Returns: one of the edges ID of the same quad-edge as the input edge.
symEdge
$res = $obj->symEdge($edge);
Subdiv2D_edgeOrg
Signature: (int [phys] edge(); float [o,phys] orgpt(n3=2); int [o,phys] res(); Subdiv2DWrapper * self)
Returns the edge origin.
($orgpt,$res) = $obj->edgeOrg($edge);
Parameters:
- edge
-
Subdivision edge ID.
- orgpt
-
Output vertex location.
Returns: vertex ID.
Subdiv2D_edgeOrg ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
Subdiv2D_edgeDst
Signature: (int [phys] edge(); float [o,phys] dstpt(n3=2); int [o,phys] res(); Subdiv2DWrapper * self)
Returns the edge destination.
($dstpt,$res) = $obj->edgeDst($edge);
Parameters:
- edge
-
Subdivision edge ID.
- dstpt
-
Output vertex location.
Returns: vertex ID.
Subdiv2D_edgeDst ignores the bad-value flag of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
CONSTANTS
- PDL::OpenCV::Imgproc::FILTER_SCHARR()
- PDL::OpenCV::Imgproc::MORPH_ERODE()
- PDL::OpenCV::Imgproc::MORPH_DILATE()
- PDL::OpenCV::Imgproc::MORPH_OPEN()
- PDL::OpenCV::Imgproc::MORPH_CLOSE()
- PDL::OpenCV::Imgproc::MORPH_GRADIENT()
- PDL::OpenCV::Imgproc::MORPH_TOPHAT()
- PDL::OpenCV::Imgproc::MORPH_BLACKHAT()
- PDL::OpenCV::Imgproc::MORPH_HITMISS()
- PDL::OpenCV::Imgproc::MORPH_RECT()
- PDL::OpenCV::Imgproc::MORPH_CROSS()
- PDL::OpenCV::Imgproc::MORPH_ELLIPSE()
- PDL::OpenCV::Imgproc::INTER_NEAREST()
- PDL::OpenCV::Imgproc::INTER_LINEAR()
- PDL::OpenCV::Imgproc::INTER_CUBIC()
- PDL::OpenCV::Imgproc::INTER_AREA()
- PDL::OpenCV::Imgproc::INTER_LANCZOS4()
- PDL::OpenCV::Imgproc::INTER_LINEAR_EXACT()
- PDL::OpenCV::Imgproc::INTER_NEAREST_EXACT()
- PDL::OpenCV::Imgproc::INTER_MAX()
- PDL::OpenCV::Imgproc::WARP_FILL_OUTLIERS()
- PDL::OpenCV::Imgproc::WARP_INVERSE_MAP()
- PDL::OpenCV::Imgproc::WARP_POLAR_LINEAR()
- PDL::OpenCV::Imgproc::WARP_POLAR_LOG()
- PDL::OpenCV::Imgproc::INTER_BITS()
- PDL::OpenCV::Imgproc::INTER_BITS2()
- PDL::OpenCV::Imgproc::INTER_TAB_SIZE()
- PDL::OpenCV::Imgproc::INTER_TAB_SIZE2()
- PDL::OpenCV::Imgproc::DIST_USER()
- PDL::OpenCV::Imgproc::DIST_L1()
- PDL::OpenCV::Imgproc::DIST_L2()
- PDL::OpenCV::Imgproc::DIST_C()
- PDL::OpenCV::Imgproc::DIST_L12()
- PDL::OpenCV::Imgproc::DIST_FAIR()
- PDL::OpenCV::Imgproc::DIST_WELSCH()
- PDL::OpenCV::Imgproc::DIST_HUBER()
- PDL::OpenCV::Imgproc::DIST_MASK_3()
- PDL::OpenCV::Imgproc::DIST_MASK_5()
- PDL::OpenCV::Imgproc::DIST_MASK_PRECISE()
- PDL::OpenCV::Imgproc::THRESH_BINARY()
- PDL::OpenCV::Imgproc::THRESH_BINARY_INV()
- PDL::OpenCV::Imgproc::THRESH_TRUNC()
- PDL::OpenCV::Imgproc::THRESH_TOZERO()
- PDL::OpenCV::Imgproc::THRESH_TOZERO_INV()
- PDL::OpenCV::Imgproc::THRESH_MASK()
- PDL::OpenCV::Imgproc::THRESH_OTSU()
- PDL::OpenCV::Imgproc::THRESH_TRIANGLE()
- PDL::OpenCV::Imgproc::ADAPTIVE_THRESH_MEAN_C()
- PDL::OpenCV::Imgproc::ADAPTIVE_THRESH_GAUSSIAN_C()
- PDL::OpenCV::Imgproc::GC_BGD()
- PDL::OpenCV::Imgproc::GC_FGD()
- PDL::OpenCV::Imgproc::GC_PR_BGD()
- PDL::OpenCV::Imgproc::GC_PR_FGD()
- PDL::OpenCV::Imgproc::GC_INIT_WITH_RECT()
- PDL::OpenCV::Imgproc::GC_INIT_WITH_MASK()
- PDL::OpenCV::Imgproc::GC_EVAL()
- PDL::OpenCV::Imgproc::GC_EVAL_FREEZE_MODEL()
- PDL::OpenCV::Imgproc::DIST_LABEL_CCOMP()
- PDL::OpenCV::Imgproc::DIST_LABEL_PIXEL()
- PDL::OpenCV::Imgproc::FLOODFILL_FIXED_RANGE()
- PDL::OpenCV::Imgproc::FLOODFILL_MASK_ONLY()
- PDL::OpenCV::Imgproc::CC_STAT_LEFT()
- PDL::OpenCV::Imgproc::CC_STAT_TOP()
- PDL::OpenCV::Imgproc::CC_STAT_WIDTH()
- PDL::OpenCV::Imgproc::CC_STAT_HEIGHT()
- PDL::OpenCV::Imgproc::CC_STAT_AREA()
- PDL::OpenCV::Imgproc::CC_STAT_MAX()
- PDL::OpenCV::Imgproc::CCL_DEFAULT()
- PDL::OpenCV::Imgproc::CCL_WU()
- PDL::OpenCV::Imgproc::CCL_GRANA()
- PDL::OpenCV::Imgproc::CCL_BOLELLI()
- PDL::OpenCV::Imgproc::CCL_SAUF()
- PDL::OpenCV::Imgproc::CCL_BBDT()
- PDL::OpenCV::Imgproc::CCL_SPAGHETTI()
- PDL::OpenCV::Imgproc::RETR_EXTERNAL()
- PDL::OpenCV::Imgproc::RETR_LIST()
- PDL::OpenCV::Imgproc::RETR_CCOMP()
- PDL::OpenCV::Imgproc::RETR_TREE()
- PDL::OpenCV::Imgproc::RETR_FLOODFILL()
- PDL::OpenCV::Imgproc::CHAIN_APPROX_NONE()
- PDL::OpenCV::Imgproc::CHAIN_APPROX_SIMPLE()
- PDL::OpenCV::Imgproc::CHAIN_APPROX_TC89_L1()
- PDL::OpenCV::Imgproc::CHAIN_APPROX_TC89_KCOS()
- PDL::OpenCV::Imgproc::CONTOURS_MATCH_I1()
- PDL::OpenCV::Imgproc::CONTOURS_MATCH_I2()
- PDL::OpenCV::Imgproc::CONTOURS_MATCH_I3()
- PDL::OpenCV::Imgproc::HOUGH_STANDARD()
- PDL::OpenCV::Imgproc::HOUGH_PROBABILISTIC()
- PDL::OpenCV::Imgproc::HOUGH_MULTI_SCALE()
- PDL::OpenCV::Imgproc::HOUGH_GRADIENT()
- PDL::OpenCV::Imgproc::HOUGH_GRADIENT_ALT()
- PDL::OpenCV::Imgproc::LSD_REFINE_NONE()
- PDL::OpenCV::Imgproc::LSD_REFINE_STD()
- PDL::OpenCV::Imgproc::LSD_REFINE_ADV()
- PDL::OpenCV::Imgproc::HISTCMP_CORREL()
- PDL::OpenCV::Imgproc::HISTCMP_CHISQR()
- PDL::OpenCV::Imgproc::HISTCMP_INTERSECT()
- PDL::OpenCV::Imgproc::HISTCMP_BHATTACHARYYA()
- PDL::OpenCV::Imgproc::HISTCMP_HELLINGER()
- PDL::OpenCV::Imgproc::HISTCMP_CHISQR_ALT()
- PDL::OpenCV::Imgproc::HISTCMP_KL_DIV()
- PDL::OpenCV::Imgproc::COLOR_BGR2BGRA()
- PDL::OpenCV::Imgproc::COLOR_RGB2RGBA()
- PDL::OpenCV::Imgproc::COLOR_BGRA2BGR()
- PDL::OpenCV::Imgproc::COLOR_RGBA2RGB()
- PDL::OpenCV::Imgproc::COLOR_BGR2RGBA()
- PDL::OpenCV::Imgproc::COLOR_RGB2BGRA()
- PDL::OpenCV::Imgproc::COLOR_RGBA2BGR()
- PDL::OpenCV::Imgproc::COLOR_BGRA2RGB()
- PDL::OpenCV::Imgproc::COLOR_BGR2RGB()
- PDL::OpenCV::Imgproc::COLOR_RGB2BGR()
- PDL::OpenCV::Imgproc::COLOR_BGRA2RGBA()
- PDL::OpenCV::Imgproc::COLOR_RGBA2BGRA()
- PDL::OpenCV::Imgproc::COLOR_BGR2GRAY()
- PDL::OpenCV::Imgproc::COLOR_RGB2GRAY()
- PDL::OpenCV::Imgproc::COLOR_GRAY2BGR()
- PDL::OpenCV::Imgproc::COLOR_GRAY2RGB()
- PDL::OpenCV::Imgproc::COLOR_GRAY2BGRA()
- PDL::OpenCV::Imgproc::COLOR_GRAY2RGBA()
- PDL::OpenCV::Imgproc::COLOR_BGRA2GRAY()
- PDL::OpenCV::Imgproc::COLOR_RGBA2GRAY()
- PDL::OpenCV::Imgproc::COLOR_BGR2BGR565()
- PDL::OpenCV::Imgproc::COLOR_RGB2BGR565()
- PDL::OpenCV::Imgproc::COLOR_BGR5652BGR()
- PDL::OpenCV::Imgproc::COLOR_BGR5652RGB()
- PDL::OpenCV::Imgproc::COLOR_BGRA2BGR565()
- PDL::OpenCV::Imgproc::COLOR_RGBA2BGR565()
- PDL::OpenCV::Imgproc::COLOR_BGR5652BGRA()
- PDL::OpenCV::Imgproc::COLOR_BGR5652RGBA()
- PDL::OpenCV::Imgproc::COLOR_GRAY2BGR565()
- PDL::OpenCV::Imgproc::COLOR_BGR5652GRAY()
- PDL::OpenCV::Imgproc::COLOR_BGR2BGR555()
- PDL::OpenCV::Imgproc::COLOR_RGB2BGR555()
- PDL::OpenCV::Imgproc::COLOR_BGR5552BGR()
- PDL::OpenCV::Imgproc::COLOR_BGR5552RGB()
- PDL::OpenCV::Imgproc::COLOR_BGRA2BGR555()
- PDL::OpenCV::Imgproc::COLOR_RGBA2BGR555()
- PDL::OpenCV::Imgproc::COLOR_BGR5552BGRA()
- PDL::OpenCV::Imgproc::COLOR_BGR5552RGBA()
- PDL::OpenCV::Imgproc::COLOR_GRAY2BGR555()
- PDL::OpenCV::Imgproc::COLOR_BGR5552GRAY()
- PDL::OpenCV::Imgproc::COLOR_BGR2XYZ()
- PDL::OpenCV::Imgproc::COLOR_RGB2XYZ()
- PDL::OpenCV::Imgproc::COLOR_XYZ2BGR()
- PDL::OpenCV::Imgproc::COLOR_XYZ2RGB()
- PDL::OpenCV::Imgproc::COLOR_BGR2YCrCb()
- PDL::OpenCV::Imgproc::COLOR_RGB2YCrCb()
- PDL::OpenCV::Imgproc::COLOR_YCrCb2BGR()
- PDL::OpenCV::Imgproc::COLOR_YCrCb2RGB()
- PDL::OpenCV::Imgproc::COLOR_BGR2HSV()
- PDL::OpenCV::Imgproc::COLOR_RGB2HSV()
- PDL::OpenCV::Imgproc::COLOR_BGR2Lab()
- PDL::OpenCV::Imgproc::COLOR_RGB2Lab()
- PDL::OpenCV::Imgproc::COLOR_BGR2Luv()
- PDL::OpenCV::Imgproc::COLOR_RGB2Luv()
- PDL::OpenCV::Imgproc::COLOR_BGR2HLS()
- PDL::OpenCV::Imgproc::COLOR_RGB2HLS()
- PDL::OpenCV::Imgproc::COLOR_HSV2BGR()
- PDL::OpenCV::Imgproc::COLOR_HSV2RGB()
- PDL::OpenCV::Imgproc::COLOR_Lab2BGR()
- PDL::OpenCV::Imgproc::COLOR_Lab2RGB()
- PDL::OpenCV::Imgproc::COLOR_Luv2BGR()
- PDL::OpenCV::Imgproc::COLOR_Luv2RGB()
- PDL::OpenCV::Imgproc::COLOR_HLS2BGR()
- PDL::OpenCV::Imgproc::COLOR_HLS2RGB()
- PDL::OpenCV::Imgproc::COLOR_BGR2HSV_FULL()
- PDL::OpenCV::Imgproc::COLOR_RGB2HSV_FULL()
- PDL::OpenCV::Imgproc::COLOR_BGR2HLS_FULL()
- PDL::OpenCV::Imgproc::COLOR_RGB2HLS_FULL()
- PDL::OpenCV::Imgproc::COLOR_HSV2BGR_FULL()
- PDL::OpenCV::Imgproc::COLOR_HSV2RGB_FULL()
- PDL::OpenCV::Imgproc::COLOR_HLS2BGR_FULL()
- PDL::OpenCV::Imgproc::COLOR_HLS2RGB_FULL()
- PDL::OpenCV::Imgproc::COLOR_LBGR2Lab()
- PDL::OpenCV::Imgproc::COLOR_LRGB2Lab()
- PDL::OpenCV::Imgproc::COLOR_LBGR2Luv()
- PDL::OpenCV::Imgproc::COLOR_LRGB2Luv()
- PDL::OpenCV::Imgproc::COLOR_Lab2LBGR()
- PDL::OpenCV::Imgproc::COLOR_Lab2LRGB()
- PDL::OpenCV::Imgproc::COLOR_Luv2LBGR()
- PDL::OpenCV::Imgproc::COLOR_Luv2LRGB()
- PDL::OpenCV::Imgproc::COLOR_BGR2YUV()
- PDL::OpenCV::Imgproc::COLOR_RGB2YUV()
- PDL::OpenCV::Imgproc::COLOR_YUV2BGR()
- PDL::OpenCV::Imgproc::COLOR_YUV2RGB()
- PDL::OpenCV::Imgproc::COLOR_YUV2RGB_NV12()
- PDL::OpenCV::Imgproc::COLOR_YUV2BGR_NV12()
- PDL::OpenCV::Imgproc::COLOR_YUV2RGB_NV21()
- PDL::OpenCV::Imgproc::COLOR_YUV2BGR_NV21()
- PDL::OpenCV::Imgproc::COLOR_YUV420sp2RGB()
- PDL::OpenCV::Imgproc::COLOR_YUV420sp2BGR()
- PDL::OpenCV::Imgproc::COLOR_YUV2RGBA_NV12()
- PDL::OpenCV::Imgproc::COLOR_YUV2BGRA_NV12()
- PDL::OpenCV::Imgproc::COLOR_YUV2RGBA_NV21()
- PDL::OpenCV::Imgproc::COLOR_YUV2BGRA_NV21()
- PDL::OpenCV::Imgproc::COLOR_YUV420sp2RGBA()
- PDL::OpenCV::Imgproc::COLOR_YUV420sp2BGRA()
- PDL::OpenCV::Imgproc::COLOR_YUV2RGB_YV12()
- PDL::OpenCV::Imgproc::COLOR_YUV2BGR_YV12()
- PDL::OpenCV::Imgproc::COLOR_YUV2RGB_IYUV()
- PDL::OpenCV::Imgproc::COLOR_YUV2BGR_IYUV()
- PDL::OpenCV::Imgproc::COLOR_YUV2RGB_I420()
- PDL::OpenCV::Imgproc::COLOR_YUV2BGR_I420()
- PDL::OpenCV::Imgproc::COLOR_YUV420p2RGB()
- PDL::OpenCV::Imgproc::COLOR_YUV420p2BGR()
- PDL::OpenCV::Imgproc::COLOR_YUV2RGBA_YV12()
- PDL::OpenCV::Imgproc::COLOR_YUV2BGRA_YV12()
- PDL::OpenCV::Imgproc::COLOR_YUV2RGBA_IYUV()
- PDL::OpenCV::Imgproc::COLOR_YUV2BGRA_IYUV()
- PDL::OpenCV::Imgproc::COLOR_YUV2RGBA_I420()
- PDL::OpenCV::Imgproc::COLOR_YUV2BGRA_I420()
- PDL::OpenCV::Imgproc::COLOR_YUV420p2RGBA()
- PDL::OpenCV::Imgproc::COLOR_YUV420p2BGRA()
- PDL::OpenCV::Imgproc::COLOR_YUV2GRAY_420()
- PDL::OpenCV::Imgproc::COLOR_YUV2GRAY_NV21()
- PDL::OpenCV::Imgproc::COLOR_YUV2GRAY_NV12()
- PDL::OpenCV::Imgproc::COLOR_YUV2GRAY_YV12()
- PDL::OpenCV::Imgproc::COLOR_YUV2GRAY_IYUV()
- PDL::OpenCV::Imgproc::COLOR_YUV2GRAY_I420()
- PDL::OpenCV::Imgproc::COLOR_YUV420sp2GRAY()
- PDL::OpenCV::Imgproc::COLOR_YUV420p2GRAY()
- PDL::OpenCV::Imgproc::COLOR_YUV2RGB_UYVY()
- PDL::OpenCV::Imgproc::COLOR_YUV2BGR_UYVY()
- PDL::OpenCV::Imgproc::COLOR_YUV2RGB_Y422()
- PDL::OpenCV::Imgproc::COLOR_YUV2BGR_Y422()
- PDL::OpenCV::Imgproc::COLOR_YUV2RGB_UYNV()
- PDL::OpenCV::Imgproc::COLOR_YUV2BGR_UYNV()
- PDL::OpenCV::Imgproc::COLOR_YUV2RGBA_UYVY()
- PDL::OpenCV::Imgproc::COLOR_YUV2BGRA_UYVY()
- PDL::OpenCV::Imgproc::COLOR_YUV2RGBA_Y422()
- PDL::OpenCV::Imgproc::COLOR_YUV2BGRA_Y422()
- PDL::OpenCV::Imgproc::COLOR_YUV2RGBA_UYNV()
- PDL::OpenCV::Imgproc::COLOR_YUV2BGRA_UYNV()
- PDL::OpenCV::Imgproc::COLOR_YUV2RGB_YUY2()
- PDL::OpenCV::Imgproc::COLOR_YUV2BGR_YUY2()
- PDL::OpenCV::Imgproc::COLOR_YUV2RGB_YVYU()
- PDL::OpenCV::Imgproc::COLOR_YUV2BGR_YVYU()
- PDL::OpenCV::Imgproc::COLOR_YUV2RGB_YUYV()
- PDL::OpenCV::Imgproc::COLOR_YUV2BGR_YUYV()
- PDL::OpenCV::Imgproc::COLOR_YUV2RGB_YUNV()
- PDL::OpenCV::Imgproc::COLOR_YUV2BGR_YUNV()
- PDL::OpenCV::Imgproc::COLOR_YUV2RGBA_YUY2()
- PDL::OpenCV::Imgproc::COLOR_YUV2BGRA_YUY2()
- PDL::OpenCV::Imgproc::COLOR_YUV2RGBA_YVYU()
- PDL::OpenCV::Imgproc::COLOR_YUV2BGRA_YVYU()
- PDL::OpenCV::Imgproc::COLOR_YUV2RGBA_YUYV()
- PDL::OpenCV::Imgproc::COLOR_YUV2BGRA_YUYV()
- PDL::OpenCV::Imgproc::COLOR_YUV2RGBA_YUNV()
- PDL::OpenCV::Imgproc::COLOR_YUV2BGRA_YUNV()
- PDL::OpenCV::Imgproc::COLOR_YUV2GRAY_UYVY()
- PDL::OpenCV::Imgproc::COLOR_YUV2GRAY_YUY2()
- PDL::OpenCV::Imgproc::COLOR_YUV2GRAY_Y422()
- PDL::OpenCV::Imgproc::COLOR_YUV2GRAY_UYNV()
- PDL::OpenCV::Imgproc::COLOR_YUV2GRAY_YVYU()
- PDL::OpenCV::Imgproc::COLOR_YUV2GRAY_YUYV()
- PDL::OpenCV::Imgproc::COLOR_YUV2GRAY_YUNV()
- PDL::OpenCV::Imgproc::COLOR_RGBA2mRGBA()
- PDL::OpenCV::Imgproc::COLOR_mRGBA2RGBA()
- PDL::OpenCV::Imgproc::COLOR_RGB2YUV_I420()
- PDL::OpenCV::Imgproc::COLOR_BGR2YUV_I420()
- PDL::OpenCV::Imgproc::COLOR_RGB2YUV_IYUV()
- PDL::OpenCV::Imgproc::COLOR_BGR2YUV_IYUV()
- PDL::OpenCV::Imgproc::COLOR_RGBA2YUV_I420()
- PDL::OpenCV::Imgproc::COLOR_BGRA2YUV_I420()
- PDL::OpenCV::Imgproc::COLOR_RGBA2YUV_IYUV()
- PDL::OpenCV::Imgproc::COLOR_BGRA2YUV_IYUV()
- PDL::OpenCV::Imgproc::COLOR_RGB2YUV_YV12()
- PDL::OpenCV::Imgproc::COLOR_BGR2YUV_YV12()
- PDL::OpenCV::Imgproc::COLOR_RGBA2YUV_YV12()
- PDL::OpenCV::Imgproc::COLOR_BGRA2YUV_YV12()
- PDL::OpenCV::Imgproc::COLOR_BayerBG2BGR()
- PDL::OpenCV::Imgproc::COLOR_BayerGB2BGR()
- PDL::OpenCV::Imgproc::COLOR_BayerRG2BGR()
- PDL::OpenCV::Imgproc::COLOR_BayerGR2BGR()
- PDL::OpenCV::Imgproc::COLOR_BayerBG2RGB()
- PDL::OpenCV::Imgproc::COLOR_BayerGB2RGB()
- PDL::OpenCV::Imgproc::COLOR_BayerRG2RGB()
- PDL::OpenCV::Imgproc::COLOR_BayerGR2RGB()
- PDL::OpenCV::Imgproc::COLOR_BayerBG2GRAY()
- PDL::OpenCV::Imgproc::COLOR_BayerGB2GRAY()
- PDL::OpenCV::Imgproc::COLOR_BayerRG2GRAY()
- PDL::OpenCV::Imgproc::COLOR_BayerGR2GRAY()
- PDL::OpenCV::Imgproc::COLOR_BayerBG2BGR_VNG()
- PDL::OpenCV::Imgproc::COLOR_BayerGB2BGR_VNG()
- PDL::OpenCV::Imgproc::COLOR_BayerRG2BGR_VNG()
- PDL::OpenCV::Imgproc::COLOR_BayerGR2BGR_VNG()
- PDL::OpenCV::Imgproc::COLOR_BayerBG2RGB_VNG()
- PDL::OpenCV::Imgproc::COLOR_BayerGB2RGB_VNG()
- PDL::OpenCV::Imgproc::COLOR_BayerRG2RGB_VNG()
- PDL::OpenCV::Imgproc::COLOR_BayerGR2RGB_VNG()
- PDL::OpenCV::Imgproc::COLOR_BayerBG2BGR_EA()
- PDL::OpenCV::Imgproc::COLOR_BayerGB2BGR_EA()
- PDL::OpenCV::Imgproc::COLOR_BayerRG2BGR_EA()
- PDL::OpenCV::Imgproc::COLOR_BayerGR2BGR_EA()
- PDL::OpenCV::Imgproc::COLOR_BayerBG2RGB_EA()
- PDL::OpenCV::Imgproc::COLOR_BayerGB2RGB_EA()
- PDL::OpenCV::Imgproc::COLOR_BayerRG2RGB_EA()
- PDL::OpenCV::Imgproc::COLOR_BayerGR2RGB_EA()
- PDL::OpenCV::Imgproc::COLOR_BayerBG2BGRA()
- PDL::OpenCV::Imgproc::COLOR_BayerGB2BGRA()
- PDL::OpenCV::Imgproc::COLOR_BayerRG2BGRA()
- PDL::OpenCV::Imgproc::COLOR_BayerGR2BGRA()
- PDL::OpenCV::Imgproc::COLOR_BayerBG2RGBA()
- PDL::OpenCV::Imgproc::COLOR_BayerGB2RGBA()
- PDL::OpenCV::Imgproc::COLOR_BayerRG2RGBA()
- PDL::OpenCV::Imgproc::COLOR_BayerGR2RGBA()
- PDL::OpenCV::Imgproc::COLOR_COLORCVT_MAX()
- PDL::OpenCV::Imgproc::INTERSECT_NONE()
- PDL::OpenCV::Imgproc::INTERSECT_PARTIAL()
- PDL::OpenCV::Imgproc::INTERSECT_FULL()
- PDL::OpenCV::Imgproc::FILLED()
- PDL::OpenCV::Imgproc::LINE_4()
- PDL::OpenCV::Imgproc::LINE_8()
- PDL::OpenCV::Imgproc::LINE_AA()
- PDL::OpenCV::Imgproc::FONT_HERSHEY_SIMPLEX()
- PDL::OpenCV::Imgproc::FONT_HERSHEY_PLAIN()
- PDL::OpenCV::Imgproc::FONT_HERSHEY_DUPLEX()
- PDL::OpenCV::Imgproc::FONT_HERSHEY_COMPLEX()
- PDL::OpenCV::Imgproc::FONT_HERSHEY_TRIPLEX()
- PDL::OpenCV::Imgproc::FONT_HERSHEY_COMPLEX_SMALL()
- PDL::OpenCV::Imgproc::FONT_HERSHEY_SCRIPT_SIMPLEX()
- PDL::OpenCV::Imgproc::FONT_HERSHEY_SCRIPT_COMPLEX()
- PDL::OpenCV::Imgproc::FONT_ITALIC()
- PDL::OpenCV::Imgproc::MARKER_CROSS()
- PDL::OpenCV::Imgproc::MARKER_TILTED_CROSS()
- PDL::OpenCV::Imgproc::MARKER_STAR()
- PDL::OpenCV::Imgproc::MARKER_DIAMOND()
- PDL::OpenCV::Imgproc::MARKER_SQUARE()
- PDL::OpenCV::Imgproc::MARKER_TRIANGLE_UP()
- PDL::OpenCV::Imgproc::MARKER_TRIANGLE_DOWN()
- PDL::OpenCV::Imgproc::TM_SQDIFF()
- PDL::OpenCV::Imgproc::TM_SQDIFF_NORMED()
- PDL::OpenCV::Imgproc::TM_CCORR()
- PDL::OpenCV::Imgproc::TM_CCORR_NORMED()
- PDL::OpenCV::Imgproc::TM_CCOEFF()
- PDL::OpenCV::Imgproc::TM_CCOEFF_NORMED()
- PDL::OpenCV::Imgproc::COLORMAP_AUTUMN()
- PDL::OpenCV::Imgproc::COLORMAP_BONE()
- PDL::OpenCV::Imgproc::COLORMAP_JET()
- PDL::OpenCV::Imgproc::COLORMAP_WINTER()
- PDL::OpenCV::Imgproc::COLORMAP_RAINBOW()
- PDL::OpenCV::Imgproc::COLORMAP_OCEAN()
- PDL::OpenCV::Imgproc::COLORMAP_SUMMER()
- PDL::OpenCV::Imgproc::COLORMAP_SPRING()
- PDL::OpenCV::Imgproc::COLORMAP_COOL()
- PDL::OpenCV::Imgproc::COLORMAP_HSV()
- PDL::OpenCV::Imgproc::COLORMAP_PINK()
- PDL::OpenCV::Imgproc::COLORMAP_HOT()
- PDL::OpenCV::Imgproc::COLORMAP_PARULA()
- PDL::OpenCV::Imgproc::COLORMAP_MAGMA()
- PDL::OpenCV::Imgproc::COLORMAP_INFERNO()
- PDL::OpenCV::Imgproc::COLORMAP_PLASMA()
- PDL::OpenCV::Imgproc::COLORMAP_VIRIDIS()
- PDL::OpenCV::Imgproc::COLORMAP_CIVIDIS()
- PDL::OpenCV::Imgproc::COLORMAP_TWILIGHT()
- PDL::OpenCV::Imgproc::COLORMAP_TWILIGHT_SHIFTED()
- PDL::OpenCV::Imgproc::COLORMAP_TURBO()
- PDL::OpenCV::Imgproc::COLORMAP_DEEPGREEN()
- PDL::OpenCV::Imgproc::Subdiv2D::PTLOC_ERROR()
- PDL::OpenCV::Imgproc::Subdiv2D::PTLOC_OUTSIDE_RECT()
- PDL::OpenCV::Imgproc::Subdiv2D::PTLOC_INSIDE()
- PDL::OpenCV::Imgproc::Subdiv2D::PTLOC_VERTEX()
- PDL::OpenCV::Imgproc::Subdiv2D::PTLOC_ON_EDGE()
- PDL::OpenCV::Imgproc::Subdiv2D::NEXT_AROUND_ORG()
- PDL::OpenCV::Imgproc::Subdiv2D::NEXT_AROUND_DST()
- PDL::OpenCV::Imgproc::Subdiv2D::PREV_AROUND_ORG()
- PDL::OpenCV::Imgproc::Subdiv2D::PREV_AROUND_DST()
- PDL::OpenCV::Imgproc::Subdiv2D::NEXT_AROUND_LEFT()
- PDL::OpenCV::Imgproc::Subdiv2D::NEXT_AROUND_RIGHT()
- PDL::OpenCV::Imgproc::Subdiv2D::PREV_AROUND_LEFT()
- PDL::OpenCV::Imgproc::Subdiv2D::PREV_AROUND_RIGHT()