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.filterByColor = True # Filter by color. params.blobColor = 255 # 0 for darkblobs - 255 for light blobs) params.filterByArea = True # Filter by Area. params.minArea = 100 params.maxArea = 600 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) for kp in keypoints: print (int(kp.pt[0]), int(kp.pt[1])) if cv2.waitKey(1) == 27: break