0

I'm working on a project where I want to run simple blob detection, but only on areas inside a contour. I know contours can return bounding rectangles or circles, but I don't see how to limit a simple blob detection to the area inside that contour.

Any thoughts? I'm stuck.

  • Get the bounding Rect of the desired contour -> Crop your image with the boundingRect -> Apply blob detection. – ZdaR Dec 20 '16 at 04:25
  • The suggestion provided by ZdaR is good to a certain extent. You may have a condition where you may want to keep the entire image and still be able to perform blob detection in that contour area. Check out the answer section. I do not have any characters left to type. :) – Jeru Luke Dec 20 '16 at 12:18

1 Answers1

0

What I am trying to say is that, consider you want to perform blob detection for a certain region of interest (ROI) on an image, but you also want to keep the image.

ZdaR's comment helps if you want that ROI area alone.

My suggestion would be:

  • Create a binary mask of the contour region you want to perform blob detection on.
  • Apply the mask on the image. You should be able to obtain only the ROI. Now perform blob detection on it.
  • Now the same binary mask and mask the ROI for which blobs have been detected with the original image.
Jeru Luke
  • 20,118
  • 13
  • 80
  • 87