Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
from classes.ImageHandler import ImageHandler
import cv2
if __name__ == "__main__":
# Initialises the ImageHandler class
imageHandler = ImageHandler()
# Create an instance of the class using the SURF (or BRISK) feature detector
imageHandler.set_detector("BRISK")
# Load an image that we want to find keypoints of interest
img = cv2.imread("./images/staff_id.jpg", cv2.IMREAD_COLOR)
# Grab some key areas of interest from the training image
keypoints = imageHandler.get_keypoints(img)
# Extract a descriptor from the training image using the key areas of interest
keypoints, descriptor = imageHandler.get_descriptor(img, keypoints)
# Draws the keypoints of interest detected from the image
img = cv2.drawKeypoints(img, keypoints, (0, 0, 0), cv2.DRAW_MATCHES_FLAGS_DRAW_OVER_OUTIMG)
# Displays the image with the detected keypoints
cv2.imshow("Window", img)
# Waits for the 'ESC' key to be pushed to close the window and end the program
if cv2.waitKey(0) == 27:
cv2.destroyAllWindows()