原理:
In last chapter, we saw Harris Corner Detector. Later in 1994, J. Shi and C. Tomasi made a small modification(前一个方法的小改进) to it in their paper Good Features to Track which shows better results compared to Harris Corner Detector. The scoring function in Harris Corner Detector was given by:
R=λ1λ2−k(λ1+λ2)2
Instead of this, Shi-Tomasi proposed:
R=min(λ1,λ2)
If it is a greater than a threshold value, it is considered as a corner. If we plot it in λ1−λ2 space as we did in Harris Corner Detector, we get an image as below:
代码使用:
corners = cv.goodFeaturesToTrack( image, maxCorners, qualityLevel, minDistance[, corners[, mask[, blockSize[, useHarrisDetector[, k]]]]] )
corners = cv.goodFeaturesToTrack( image, maxCorners, qualityLevel, minDistance, mask, blockSize, gradientSize[, corners[, 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 | 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. |