Page 1 of 1

Area_Threshold vs Pixel_Threshold

Posted: Tue Apr 23, 2019 7:28 pm
by Chris19
Good Day!

From the find_blobs definition https://docs.openmv.io/library/omv.imag ... find_blobs we have
image.find_blobs(thresholds[, invert=False[, roi[, x_stride=2[, y_stride=1[, area_threshold=10[, pixels_threshold=10[, merge=False[, margin=0[, threshold_cb=None[, merge_cb=None[, x_hist_bins_max=0[, y_hist_bins_max=0]]]]]]]]]]]])

. . .

If a blob’s bounding box area is less than area_threshold it is filtered out.

If a blob’s pixel count is less than pixel_threshold it is filtered out.


When should area_threshold be used vs pixel_threshold vs both? Which is faster and/or optimal?

Your sample programs use both - but our team cannot figure out why:

Code: Select all

    for blob in img.find_blobs([threshold], pixels_threshold=100, area_threshold=100, merge=True, margin=10):
Thanks,

Re: Area_Threshold vs Pixel_Threshold

Posted: Tue Apr 23, 2019 7:46 pm
by kwagyeman
It enforces blob density. E.g. the blob is large and mostly full of matching pixels. You don't need to check both however.

Re: Area_Threshold vs Pixel_Threshold

Posted: Wed Apr 24, 2019 5:40 am
by Chris19
Thanks, that makes sense!

So when would you only use one and when do you recommend using both Area and Pixel in the search parameters?

Re: Area_Threshold vs Pixel_Threshold

Posted: Wed Apr 24, 2019 2:00 pm
by kwagyeman
I recommend both to filter out noise pixels. It's quite hard to get color bounds setup to only target some pixel. So, these values are essential for removing noise blobs. Thus you can relax color bounds.

Re: Area_Threshold vs Pixel_Threshold

Posted: Wed Apr 24, 2019 6:54 pm
by Chris19
Thanks! Very appreciated