How to select different colors at the same time in Image J


I need to measure the vegetation cover area of the green roof.
I’m using Image J to measure them, and I’m new to Image J.
I don’t find using “Color Threshold” as an excellent method to select all the vegetation at the same time because neither of the plants nor the substrates is in uniform color.

Do you have any suggestions or recommendations that I could be effectively using image J to measure the vegetation cover?

Here is the image of the green roof for practice (but of course, I’ll to use aerial pictures )

You can have a look at Weka Segmentation:

Its a machine learning based pixel classification tool that allows to use many different image features.


You could also try color clustering. There is a plugin here Plugins > Segmentation > Color Clustering .
You can cluster on RGB channels but it may be better to choose other color spaces (read a bit on color spaces).

I just tried to find some documentation but didn’t.
@iarganda Is there some documentation online? You showed us the tool in the last Neubias and it worked quite cool.


Not yet :frowning: But you can have a look at the presentation of that class in the Neubias course (slides 21-56). There you have a step-by-step example :wink:


I tried to use TWS. This is very intuitive and user friendly, yet it took me so long time to train the machine in my computer But it was a good opportunity to learn about this.
Thank you so much for your suggestion. I really appreciate it.
I know for sure this would help me for the future! :slight_smile:

1 Like

Thank you @iarganda and @noreenw so much for your comment and suggestion! This way, I was actually able to figure it out.

With that, I wonder if you could give me some of your advice in regards to adjusting the selection or the result of the color clustering.

Here in the picture below highlighted are the parts I want to improve the result. For instance, the green line at the hose is not part of the vegetation cover and some of the vegetations are not selected.

This is the raw picture.

Thank you so much for your help, I really appreciate it!


Thanks for sharing your updates @Hayan_Lee!

The brown roots and the green hose is likely to be hard to assign to the right class with color clustering. Because the clustering happens purely based on color - and a brown root is colorwise closer to the stones than to the green leave.
In other words, the algorithm has no concept of plants, or of actually any spatial structure.
You might be able to separate the white flowers into a separate class by increasing the number of clusters (doubleclick on SimpleKMeans).
But roots are tough. Can try to play with the channel selection.

If you want to teach the algorithm more you need a different tool - like Trainable Weka Segmentation (suggested by @schmiedc), or the separate software Ilastik which does very similar things.
Consider creating separate classes for plant parts which all belong to plants but do look very different. Fore example: (1) background, (2) green leaves, (3) roots

Alternatively you could also opt for getting a pretty good segmentation based on color and then correcting it manually.

Good luck!