How to do it...

You need to complete the following steps:

  1. Import the necessary modules:
import cv2import numpy as np
  1. Load an image and find its corners with cv2.cornerHarris:
img = cv2.imread('../data/scenetext01.jpg', cv2.IMREAD_COLOR)corners = cv2.cornerHarris(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY), 2, 3, 0.04)
  1. Process and display the result:
corners = cv2.dilate(corners, None)show_img = np.copy(img)show_img[corners>0.01*corners.max()]=[0,0,255]corners = cv2.normalize(corners, None, 0, 255, cv2.NORM_MINMAX).astype(np.uint8)show_img = np.hstack((show_img, cv2.cvtColor(corners, cv2.COLOR_GRAY2BGR)))cv2.imshow('Harris corner detector', show_img)if cv2.waitKey(0) == 27:    cv2.destroyAllWindows()
  1. Create a FAST detector and apply it to the ...

Get OpenCV 3 Computer Vision with Python Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.