Remove background and colour thresholds for batch

Hello everyone!

This is my first time using image j, and I am using it to analyse some images of ro ses for a research project. A sample is shown below.
Essentially I would like to create a macro that calculates the area of blue, white and the whole area of the flower. BUT the struggle i am having is the background. When taking the images there was some light hitting the dust in the foreground, which I’m struggling to separate from the actual white rose in the colour threshold function. There is also a reflection at the very bottom of the screen, which i would like to remove.

So far i have tried the subtract background option under, and that turns it all pinky, but how do i turn this black?
(and I would of course use the crop option to get rid of the reflection)
Some way that would work with a macro would be great because there are a few thousand images to get through.

Any help is appreciated,
thankyou!

@Alice_Howie

It’s not so easy with this type of image… too - you should be sure to NEVER save your images as JPEG files (you can read on why here).

I would point you towards the Trainable Weka Segmentation plugin (which is macro-recordable). Just using the default settings… I got decent segmentation:

51%20AM

There is room for improvement there for sure - but is a good start. Too - with the reflection issue - is it roughly at the same position in each image? Then you can consider cropping your images first.

1 Like