I use python3.x, opencv3.x. The cv2.drawKeypoints() function is introduced in the official documentation and mainly contains five parameters:
- image: the original image
- keypoints: The key points obtained from the original image, which are also the data used when drawing
- outputimage: output
- color: Color settings, by modifying the value of (b, g, r), change the color of the brush, b=blue, g=green, r=red.
- flags: The flag setting of the drawing function, (the value of the possible flag is defined by DrawMatchesFlags, which is specific to the function DrawMatchesFlags in c++ ). In Python, the flag is modified by cv2.DRAW_MATCHES_FLAGS_DEFAULT, cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS, cv2.DRAW_MATCHES_FLAGS_DRAW_OVER_OUTIMG, cv2.DRAW_MATCHES_FLAGS_NOT_DRAW_SINGLE_POINTS
im_with_keypoints = cv2.drawKeypoints(im, keypoints, np.array([]), (255,0,0), cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
The example is above, this is a sentence of another blob analysis I wrote, please see that blog for details. In this program, im is the original image, the key points are keypoints, and the output is placed in a new array. The blue calibration used here is based on personal preference. The flags are very interesting, this is a setting of the identification method, literally, for example, using the cv2.DRAW_MATCHES_FLAGS_DEFAULT parameter, indicating that the default parameters are used, this method is relatively simple, in the program I used to draw with blob, I only drew the center point of the circle. But if you use cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS, he will draw it in a rich way, and the effect will be better.