OpenCV  4.5.1
Open Source Computer Vision
Graph API: Image Feature Detection


GMat cv::gapi::Canny (const GMat &image, double threshold1, double threshold2, int apertureSize=3, bool L2gradient=false)
 Finds edges in an image using the Canny algorithm. More...
GArray< Point2fcv::gapi::goodFeaturesToTrack (const GMat &image, int maxCorners, double qualityLevel, double minDistance, const Mat &mask=Mat(), int blockSize=3, bool useHarrisDetector=false, double k=0.04)
 Determines strong corners on an image. More...

Detailed Description

Function Documentation

◆ Canny()

GMat cv::gapi::Canny ( const GMat image,
double  threshold1,
double  threshold2,
int  apertureSize = 3,
bool  L2gradient = false 

#include <opencv2/gapi/imgproc.hpp>

Finds edges in an image using the Canny algorithm.

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

Function textual ID is "org.opencv.imgproc.feature.canny"
image8-bit input image.
threshold1first threshold for the hysteresis procedure.
threshold2second threshold for the hysteresis procedure.
apertureSizeaperture size for the Sobel operator.
L2gradienta flag, indicating whether a more accurate \(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 ).

◆ goodFeaturesToTrack()

GArray<Point2f> cv::gapi::goodFeaturesToTrack ( const GMat image,
int  maxCorners,
double  qualityLevel,
double  minDistance,
const Mat mask = Mat(),
int  blockSize = 3,
bool  useHarrisDetector = false,
double  k = 0.04 
retval=cv.gapi.goodFeaturesToTrack(image, maxCorners, qualityLevel, minDistance[, mask[, blockSize[, useHarrisDetector[, k]]]])

#include <opencv2/gapi/imgproc.hpp>

Determines strong corners on an image.

The function finds the most prominent corners in the image or in the specified image region, as described in [216]

  • 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.

  • 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 .
  • Function textual ID is "org.opencv.imgproc.feature.goodFeaturesToTrack"
imageInput 8-bit or floating-point 32-bit, single-channel image.
maxCornersMaximum 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.
qualityLevelParameter 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.
minDistanceMinimum possible Euclidean distance between the returned corners.
maskOptional 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.
blockSizeSize of an average block for computing a derivative covariation matrix over each pixel neighborhood. See cornerEigenValsAndVecs .
useHarrisDetectorParameter indicating whether to use a Harris detector (see cornerHarris) or cornerMinEigenVal.
kFree parameter of the Harris detector.
vector of detected corners.