Drawing keypoints, descriptors, and matches
After you've found the keypoints, you undoubtedly want to see where these keypoints are in the original image. OpenCV serves as a convenient way to display the keypoints and other related information. Moreover, you can easily draw a correspondence between keypoints from different images. This recipe tells you about how you can visualize keypoints as well as matching results.
Getting ready
Before you proceed with this recipe, you need to install the OpenCV version 3.3 (or greater) Python API package.
How to do it...
You need to complete the following steps:
- Import the necessary modules:
import cv2 import numpy as np import random
- Load an image, find the FAST keypoints in it, and fill in the size and orientation of each keypoint with random values:
img = cv2.imread('../data/scenetext01.jpg', cv2.IMREAD_COLOR) fast = cv2.FastFeatureDetector_create(160, True, cv2.FAST_FEATURE_DETECTOR_TYPE_9_16) keyPoints = fast.detect(img) for kp in keyPoints: kp.size...