0

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).

Rishi
  • 13
  • 3
  • you can see these links https://www.pyimagesearch.com/2016/02/08/opencv-shape-detection/ , https://www.pyimagesearch.com/2016/10/31/detecting-multiple-bright-spots-in-an-image-with-python-and-opencv/ , https://www.learnopencv.com/blob-detection-using-opencv-python-c/ – user8190410 Aug 29 '18 at 16:59
  • I have gone through both the link before but that did not help. I have no idea how to analyze the key points detected in the image – Rishi Aug 30 '18 at 03:45

0 Answers0