Home Finding Corners
Post
Cancel

Finding Corners

How to Detect Corners?

A corner is a point whose local neighborhood stands in two dominant and different edge directions. In other words, a corner can be interpreted as the junction of two edges, where an edge is a sudden change in image brightness.



And there is two algorithms in openCV which is :

  • cv2.cornerHarris(src, blockSize, ksize, k) -> dst where:
    • src : Should be grayscale and float32 type.
    • blockSize : The size of neighborhood considered for corner detection
    • ksize : Aperture parameter of Sobel derivative used.
    • k : Harris detector free parameter in the equation $ dst(x,y)\ =\ detM^{(x,y)}\ -\ k(trM^{(x,y)})^{2}$ where $M^{(x,y)}$ over a blockSize * blockSize neighborhood.
    • dst : Array of corner locations (x,y)

  • cv2.goodFeaturesToTrack(image, maxCorners, qualityLevel, minDistance, mask, blockSize) -> dst where:
    • image : 8-bit or floating-point 32-bit, single-channel image.
    • maxCorners : Maximum number of corners to return. If there are more corners than are found, the strongest of them is returned.
    • qualityLevel : Parameter characterizing the minimal accepted quality of image corners. The parameter value is multiplied by the best corner quality measure (smallest eigenvalue). 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. Default = empty.
    • blockSize : Size of an average block for computing a derivative covariation matrix over each pixel neighborhood. Default = 3
    • dst : Array of corner locations (x,y)



Result









Implementation

This post is licensed under CC BY 4.0 by the author.