0

I'm having issues with Simple Blob Detector not detecting blobs bigger than 300.

I have this image with a Lego block inside of it, but no matter what area I give it it just won't detect it. Any ideas? I'm trying to get the color of the lego, but I want to filter out everything else

params = cv2.SimpleBlobDetector_Params()
params.filterByArea = True
params.minArea = 500 # Tried using from 300 - 3000 and can't get a detection
params.filterByCircularity = False
params.filterByColor = False
params.filterByConvexity = False
params.filterByInertia = False
detector = cv2.SimpleBlobDetector_create(params)
keypoints = detector.detect(img)

Won't detect the block

Bk Razor
  • 1,492
  • 1
  • 14
  • 24
  • Perhaps you need to read in your input image as grayscale. See also https://stackoverflow.com/questions/8076889/how-to-use-opencv-simpleblobdetector – fmw42 Mar 18 '19 at 05:25
  • @fmw42 BGR images are automatically converted to grayscale, so no need to explicitly do this unless you want to detect in a particular channel. – Piglet Mar 18 '19 at 09:52
  • `@Piglet` That does not make sense to me. What command does that? When reading a color image, the reading command must specify to convert to grayscale otherwise all color images would become grayscale. – fmw42 Mar 18 '19 at 17:52

1 Answers1

0

Your parameters are insufficient. It's never a good idea to search anything. You should always add as many constraints as possible.

I suggest you add more paramters. I found your brick by simply adding a maxArea of 100000.

A minArea of 500 doesn't make too much sense to me as the smallest lego parts would exceed this by far.

Piglet
  • 27,501
  • 3
  • 20
  • 43