I'm working on detection of blobs and doing image processing (like histogram analysis) on them. Although I detected the blobs using OpenCV SimpleBlobDetector_create(params)
, Now I want to perform image processing/analysis on each and every blob detected.
After reading the image in grayscale (and storing it in im
variable) I have written the following operation to detect blobs
# Setup SimpleBlobDetector parameters.
params = cv2.SimpleBlobDetector_Params()
# Change thresholds
params.minThreshold = 10;
params.maxThreshold = 200;
# Filter by Area.
params.filterByArea = True
params.minArea = 200
# Filter by Circularity
params.filterByCircularity = True
params.minCircularity = 0.30
# Filter by Convexity
params.filterByConvexity = True
params.minConvexity = 0.5
# Filter by Inertia
params.filterByInertia = True
params.minInertiaRatio = 0.001
#now let us do blob analysis
#Set up the detector with default parameters.
detector = cv2.SimpleBlobDetector_create(params)
#Detect blobs.
keypoints = detector.detect(im)
im_with_keypoints = cv2.drawKeypoints(im, keypoints, np.array([]), (0,0,255), cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
This gives the following image:
Output Image After Blob Detection
From what I understand, the cv2.SimpleBlobDetector_create(params)
outputs keypoints. The variable type of each keypoints is cv2.keypoint
. I tried to understand what keypoints are from here but that did not help much. I would appreciate if someone shows me a direction as to how to analyze (image processing like histogram analysis) the region inside keypoints (or in this case, the blobs).