What is an angle?
An angle can be interpreted as the connection of two edges (where the edge is a sudden change in the brightness of the image).
Shi-Tomazi Corner Discovery —
Discovery of Shi-Tomasi Corner was published by J.Shi and C.Tomasi in their article " Good Tracking Performance ". The basic intuition here is that corners can be detected by looking for significant changes in all directions.
We look at a small window in the image, then scan the entire image for corners.
Offset of this small window in any direction will cause a significant change in appearance if that particular window ends up in a corner.
Flat regions will not change in any direction.
If there is an edge, then there will be no significant changes along the direction of the edge.
Mathematical overview —
For window (W) located at point (X, Y) with pixel intensity I (X, Y), the formula for determining the Shi-Tomasi angle is —
f ( X, Y) = Σ (I (X k , Y k ) - I (X k + ΔX, Y k + ΔY)) 2 where (X k , Y k ) ϵ W
If we scan an image with a window, as if we were working with the kernel, and we notice that there is an area in which significant changes are taking place, no matter which direction we are actually in scan, then we have a good intuition that there is probably an angle there.
Calculating f (X, Y) will be very slow. Therefore, we use the Taylor extension to simplify the scoring function, R.
R = min (λ 1 , λ 2 ) where λ 1 , λ 2 are the eigenvalues of the resulting matrix
Using the function
goodFeaturesToTrack () —
Syntax: cv2.goodFeaturesToTrack (gray_img, maxc, Q, minD)
gray_img - Grayscale image with integral values
maxc - Maximum number of corners we want (give negative value to get all the corners)
Q - Quality level parameter (preferred value = 0.01)
maxD - Maximum distance (preferred value = 10)
Below is the Python implementation of the Shi-Tomazi angle definition: