Automatic Threshold Change if no object is identified

Hi,

I want to run large batches of images, but I often have to manually change the threshold for each image because no object is identified. Sometimes I even have to used a different method (for IdentifyObject modules) on the image to get it to identify the object. Is there any way to automatically try a new method if no object is identified so that I can use the same method for all of the images, regardless of the different threshold coefficients needed?

I would greatly appreciate your help!
Suzie

Hi Suzie,

My suggestion for your problem is see if there are additional settings in IdentifyPrimaryObjects that can be adjusted so that objects are identified consistently. The thresholding method is just one of several settings that affect foreground/background determination, e.g., threshold correction factor, etc. Also, if the background intensity is wildly varying from image to image, background subtraction of some kind is needed to place images on the same level, so to speak.

Would you care to post your pipeline, and a couple of images, one where all the desired objects are identified and one in which they are not?

Regards,
-Mark

Hi Mark,

Thanks for the response! I’ll attach here the images and the two pipelines (the background method for thresholding works on these images and the Otsu method does not). Thank you for the help!

Suzie
Thresholding.zip (964 KB)

Hi Suzie,
I would suggest changing the thresholding method to Otsu with 3-class thresholding and the middle class set to Background. Also, you may want to drop your lower bound on the diameter a bit; 100 seemed to be a bit too high. perhaps 50 or so?
-Mark