How can I force simpleblobdetection to only search inside a contour area?

193 Views Asked by At

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.

1

There are 1 best solutions below

1
On

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.