How to construct a feature-filter for blob detection?

When i use the function “image.find_blobs(thresholds, invert=False, roi=Auto, feature_filter=Auto)”,i notice that there is a paramter of “feature_filter” which can be used to filter some blobs,but i cann’t find out how to bulid this filter in python IDE,Anybody have a good idea? Thanks!

Hi,

the feature filter function is just a function which accepts and image and then a blob as an argument:

def feature_filter(img, blob):
		return True

And then return True or False to filter the blob based on the blob parameters. Also, you can just filter the blob after it is created. I put this function in so that you could turn off filtering for small blobs but it might make sense to remove it in the future.

Note that you can recursively call more blob detection functions (if memory allows) in the feature filter. However, I wouldn’t do that. Just check the blob arguments.

You pass the feature filter function name as the last argument. So, find_blobs(…, feature_filter=function_name).

Thanks a lot! it’s exactly information i need!

Fast help support!

:smiley: I will try to ask some questions on your sleeping time! :laughing: