1. - determne which windows produce very large
variatons in intensity when moved in both X and Y directions.
2. - With each such windows found, a score R is
computed.
3. - After applying a threshold to this score,
important corners are selected & marked.
Img: imput image, it should be grayscale and float32 type.
blockSize: It is the size of neighbourhood considered for
corner detection
ksize: Aperture parameter of Sobel derivative used.
K: Harris detector free parameter in the
equation.[Red Marks Detected Corners]
import numpy as np
import cv2 as cv
img = cv.imread('chessboard.png')
cv.imshow('img', img)
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
gray = np.float32(gray)
dst = cv.cornerHarris(gray, 2, 3, 0.04)
dst = cv.dilate(dst, None)
img[dst > 0.01*dst.max()] = [0, 0, 255]
cv.imshow('dst', img)
if cv.waitKey(0) & 0xff == 27:
cv.destroyAllWindows()
import cv2 as cv
img = cv.imread('chessboard.png')
cv.imshow('img', img)
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
gray = np.float32(gray)
dst = cv.cornerHarris(gray, 2, 3, 0.04)
dst = cv.dilate(dst, None)
img[dst > 0.01*dst.max()] = [0, 0, 255]
cv.imshow('dst', img)
if cv.waitKey(0) & 0xff == 27:
cv.destroyAllWindows()
No comments:
Post a Comment