How it works...

To visualize keypoints, you need to use cv2.drawKeypoints. This function takes a source image, a list of keypoints, a destination image, a color, and flags as arguments. In the simplest case, you only need to pass the first three. The source image is used as a background, but it isn't changed by this function, and the result will be placed in the destination image. The list of keypoints is an object, which is returned by the keypoints detector, so you can pass this list directly to the cv2.drawKeypoints function without any processing. The color is simply the drawing color. The last parameter, flags, allows you to control the drawing mode—by default, it has the cv2.DRAW_MATCHES_FLAGS_DEFAULT value, and in this case, the keypoints ...

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.