OpenCV return keypoints coordinates and area from blob detection, Python

后端 未结 2 1823
情歌与酒
情歌与酒 2021-02-19 06:18

I followed a blob detection example (using cv2.SimpleBlobDetector) and successfully detected the blobs in my binary image. But then I don\'t know how to extract the

相关标签:
2条回答
  • 2021-02-19 07:09

    If you have a list of keypoints. Then you can print as shown below

    for keyPoint in keyPoints:
        x = keyPoint.pt[0]
        y = keyPoint.pt[1]
        s = keyPoint.size
    

    Edit: Size determines the diameter of the meaningful keypoint neighborhood. You can use that size and roughly calculate the area of the blob.

    0 讨论(0)
  • 2021-02-19 07:14

    The pt property:

    keypoints = detector.detect(frame) #list of blobs keypoints
    x = keypoints[i].pt[0] #i is the index of the blob you want to get the position
    y = keypoints[i].pt[1]
    

    Some documentation

    0 讨论(0)
提交回复
热议问题