Edge Detection
Canny
Finds edges in an image using the Canny algorithm.8-bit input image.
16-bit x derivative of input image (CV_16SC1 or CV_16SC3).
16-bit y derivative of input image (same type as dx).
Output edge map; single channels 8-bit image, which has the same size as image.
First threshold for the hysteresis procedure.
Second threshold for the hysteresis procedure.
Aperture size for the Sobel operator.
A flag, indicating whether a more accurate L2 norm should be used to calculate the image gradient magnitude (L2gradient=true), or whether the default L1 norm is enough (L2gradient=false).
- C++
- Python
Derivatives and Gradients
Sobel
Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator.Input image.
Output image of the same size and the same number of channels as src.
Output image depth. In the case of 8-bit input images it will result in truncated derivatives.
Order of the derivative x.
Order of the derivative y.
Size of the extended Sobel kernel; it must be 1, 3, 5, or 7.
Optional scale factor for the computed derivative values; by default, no scaling is applied.
Optional delta value that is added to the results prior to storing them in dst.
Pixel extrapolation method. BORDER_WRAP is not supported.
Scharr
Calculates the first x- or y- image derivative using Scharr operator.Input image.
Output image of the same size and the same number of channels as src.
Output image depth.
Order of the derivative x.
Order of the derivative y.
Optional scale factor for the computed derivative values.
Optional delta value that is added to the results prior to storing them in dst.
Pixel extrapolation method. BORDER_WRAP is not supported.
Laplacian
Calculates the Laplacian of an image.Source image.
Destination image of the same size and the same number of channels as src.
Desired depth of the destination image.
Aperture size used to compute the second-derivative filters. The size must be positive and odd.
Optional scale factor for the computed Laplacian values.
Optional delta value that is added to the results prior to storing them in dst.
Pixel extrapolation method. BORDER_WRAP is not supported.
Corner Detection
cornerHarris
Harris corner detector.Input single-channel 8-bit or floating-point image.
Image to store the Harris detector responses. It has the type CV_32FC1 and the same size as src.
Neighborhood size.
Aperture parameter for the Sobel operator.
Harris detector free parameter.
Pixel extrapolation method. BORDER_WRAP is not supported.
cornerMinEigenVal
Calculates the minimal eigenvalue of gradient matrices for corner detection.Input single-channel 8-bit or floating-point image.
Image to store the minimal eigenvalues. It has the type CV_32FC1 and the same size as src.
Neighborhood size.
Aperture parameter for the Sobel operator.
Pixel extrapolation method. BORDER_WRAP is not supported.
goodFeaturesToTrack
Determines strong corners on an image.Input 8-bit or floating-point 32-bit, single-channel image.
Output vector of detected corners.
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.
Parameter characterizing the minimal accepted quality of image corners. The parameter value is multiplied by the best corner quality measure.
Minimum possible Euclidean distance between the returned corners.
Optional region of interest.
Size of an average block for computing a derivative covariation matrix over each pixel neighborhood.
Parameter indicating whether to use a Harris detector or cornerMinEigenVal.
Free parameter of the Harris detector.
Hough Transform
HoughLines
Finds lines in a binary image using the standard Hough transform.8-bit, single-channel binary source image. The image may be modified by the function.
Output vector of lines. Each line is represented by a 2 or 3 element vector (ρ, θ) or (ρ, θ, votes).
Distance resolution of the accumulator in pixels.
Angle resolution of the accumulator in radians.
Accumulator threshold parameter. Only those lines are returned that get enough votes (>threshold).
For the multi-scale Hough transform, it is a divisor for the distance resolution rho.
For the multi-scale Hough transform, it is a divisor for the distance resolution theta.
Minimum angle to check for lines. Must fall between 0 and max_theta.
Upper bound for the angle. Must fall between min_theta and CV_PI.
HoughLinesP
Finds line segments in a binary image using the probabilistic Hough transform.8-bit, single-channel binary source image. The image may be modified by the function.
Output vector of lines. Each line is represented by a 4-element vector (x₁, y₁, x₂, y₂), where (x₁,y₁) and (x₂, y₂) are the ending points of each detected line segment.
Distance resolution of the accumulator in pixels.
Angle resolution of the accumulator in radians.
Accumulator threshold parameter. Only those lines are returned that get enough votes (>threshold).
Minimum line length. Line segments shorter than that are rejected.
Maximum allowed gap between points on the same line to link them.
HoughCircles
Finds circles in a grayscale image using the Hough transform.8-bit, single-channel, grayscale input image.
Output vector of found circles. Each vector is encoded as 3 or 4 element floating-point vector (x, y, radius) or (x, y, radius, votes).
Detection method. The available methods are HOUGH_GRADIENT and HOUGH_GRADIENT_ALT.
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.
Minimum distance between the centers of the detected circles.
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.
Second method-specific parameter. In case of HOUGH_GRADIENT, it is the accumulator threshold for the circle centers at the detection stage.
Minimum circle radius.
Maximum circle radius. If <= 0, uses the maximum image dimension.
- C++
- Python
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.
Enumerations
HoughModes
Variants of Hough transform:HOUGH_STANDARD- Classical or standard Hough transformHOUGH_PROBABILISTIC- Probabilistic Hough transform (more efficient)HOUGH_MULTI_SCALE- Multi-scale variant of the classical Hough transformHOUGH_GRADIENT- 21HT for circlesHOUGH_GRADIENT_ALT- Variation of HOUGH_GRADIENT to get better accuracy
