Created
October 1, 2019 22:49
-
-
Save pknowledge/b5cb86c8becef44fb3136ccb03a766d8 to your computer and use it in GitHub Desktop.
Harris Corner Detector in OpenCV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import cv2 as cv | |
img = cv.imread('chessboard_img.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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment