Itay Nega
Itay Nega

Reputation: 1

deleting a cv2.KeyPoint object from a list

I'm trying to detect certain circles in an image. I did managed to detect all circles, but when I tried to delete some of them it failed.

# Detect blobs
keypoints = detector.detect(image) # creates list with elements of the class cv2.KeyPoint

print(len(keypoints)) # prints 263

for key in keypoints:
    if key.size > 50:
        keypoints.remove(key)

print(len(keypoints)) # prints 131

there are only about 20 circles whos size in smaller than 50 (I printed the size of each circle), so I could not delete half of the wanted elements.

I couldn't figure out why it didn't work, would love for you help

thanks!

Upvotes: 0

Views: 316

Answers (0)

Related Questions