import numpy as np import cv2 cap = cv2.VideoCapture(0) while (True): ret, frame = cap.read() params = cv2.SimpleBlobDetector_Params() params.minThreshold = 10; # Change thresholds params.maxThreshold = 300; params.filterByArea = True # Filter by Area. params.minArea = 200 params.maxArea = 600 params.filterByCircularity = False # Filter by Circularity params.minCircularity = 0.1 params.maxCircularity = 1 params.filterByConvexity = False # Filter by Convexity params.minConvexity = 0.87 params.maxConvexity = 2 params.filterByInertia = False # Filter by Inertia params.minInertiaRatio = 0.01 params.maxInertiaRatio = 0.1 detector = cv2.SimpleBlobDetector_create(params) keypoints = detector.detect(frame) im_with_keypoints = cv2.drawKeypoints(frame, keypoints, np.array([]), (0,0,255), cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS) cv2.imshow('frame', im_with_keypoints) if cv2.waitKey(1) == 27: break