corner_harris
-
skimage.feature.corner_harris(image, method='k', k=0.05, eps=1e-06, sigma=1)
[source] -
Compute Harris corner measure response image.
This corner detector uses information from the auto-correlation matrix A:
A = [(imx**2) (imx*imy)] = [Axx Axy] [(imx*imy) (imy**2)] [Axy Ayy]
Where imx and imy are first derivatives, averaged with a gaussian filter. The corner measure is then defined as:
det(A) - k * trace(A)**2
or:
2 * det(A) / (trace(A) + eps)
Parameters: image : ndarray
Input image.
method : {‘k’, ‘eps’}, optional
Method to compute the response image from the auto-correlation matrix.
k : float, optional
Sensitivity factor to separate corners from edges, typically in range
[0, 0.2]
. Small values of k result in detection of sharp corners.eps : float, optional
Normalisation factor (Noble’s corner measure).
sigma : float, optional
Standard deviation used for the Gaussian kernel, which is used as weighting function for the auto-correlation matrix.
Returns: response : ndarray
Harris response image.
References
[R134] http://kiwi.cs.dal.ca/~dparks/CornerDetection/harris.htm [R135] http://en.wikipedia.org/wiki/Corner_detection Examples
>>> from skimage.feature import corner_harris, corner_peaks >>> square = np.zeros([10, 10]) >>> square[2:8, 2:8] = 1 >>> square.astype(int) array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) >>> corner_peaks(corner_harris(square), min_distance=1) array([[2, 2], [2, 7], [7, 2], [7, 7]])
Please login to continue.