Segmentation region


Hello everyone,

I would like to apply a region detection on pictures of greenery tiles. I tried with a plugin growing region method and also the thresholding but the obtained results were bad. Please could you give me some other solutions allowing me to detect these areas of greenness.

This is an example picture:

Thank you for your help.


Have you tried using the Trainable Weka Segmentation plugin? You probably won’t need as many features as they are selected by default. Have a look at the recommendations we give in the manual (section 3.5) provided as supplementary material of the plugin publication.


Thank you for your help, but i couldn’t open the link of manual (Access denied)?



You are right. It seems the link is public but has an expiration time. So I have changed it to the original paper link. Please go to “Supplementary information” and click on “Supplementary data”.


Thank you for your response.


Dear iarganda,

I have two questions about weka segmentation?
The first one: For the training classifier, I must choose the different classes to run the weka segmentation. Can I start the processing without choosing these classes? If no, can I have other solution to detect automatically these regions with other algorithms? Because I have different regions and I couldn’t select it manually?
My second question: For “setting the classifier”, I added some features but I couldn’t have a result. It seems to me I have a warning ImageScience Library. Could you help me please?
Best regards,


No, you need to define some classes because the plugin uses by default supervised learning (i.e. it trains a model based on your predefined samples of given classes). I though you knew the regions you wanted to segment. Otherwise, how did you know your previous results were bad?

You could use clustering, but usually predefining the number of clusters. Have a look at this example.

That I don’t understand. What was the problem? You can use any selection tool from Fiji to trace your regions.

Yes, that’s explained in the plugin site. You need to enable the ImageScience update site if you want to use its features.


This is my picture and I would like to select a different regions of greenery tiles.

I tried with different plugins (watershed, thresholding segmentation, region growing… ) but I couldn’t have a good results because my picture it’s based of deformable contour.

Thank you for response.


Trainable Weka Segmentation is a pixel classification tool, so you need to trace the pixels you want to classify as belonging to one class (or region in your case) or another. I tried using 5 classes (metal, background, white moss, brown moss and rust) and tracing pixels of each of them in your image:

(I didn’t have an image without your ellipses so I used it anyway as it is)

These are my settings:

And these are some initial results:


Thank you for your help


I’m very interested by your plugin Weka segmentation but I have some more difficult to choose the different classes? I would like to understand more your plugin? I have searched about that but I didn’t find the classification method?

  1. Can you explain more about the choice for this classification?
  2. How is selected the segmentation of the picture? I mean this segmentation is calculated about what (regions, form or color)? Basically, what is the parameter for this segmentation calculation and for these selections?

Thank your for your response.


The key here is to understand that the segmentation problem has been translated into a pixel classification problem. In other words, the plugin assigns a class label to each pixel of the input image, so all pixels with the same label will be part of the same “category”. It is the user task to decide which classes to use depending on his/her specific problem. For instance, if you want to separate some cells from the background, you would select two classes: one for the cell pixels and one for the background pixels.

The second task of the user is to provide some samples (what I called before “traces” since they are usually introduced as freehand ROIs) of pixels of each class. To follow with my previous example, you would select some cell pixels and add them to the cell class, and some background pixels and add them to the background class. Those will be what we call the “training samples”, because the plugin will then train a classifier on how to differentiate best those type of pixels. Once the classifier is trained, it will be applied to all pixels in the image to produce the final label image.

Each pixel is represented by not only its intensity but a set of image features that contain information about texture, borders, color, hue, etc. The image features to use are selected by clicking on the Settings button.

I hope this helps you clarifying how the plugin works!


Thank you for your response.

I appreciate your reactivity.
You said for each pixel contains not only the intensity but also the texture, the border and some other parameter. If I correctly understood, we have a cluster of information for each pixel and after that these pixels will be classified by category. The segmentation of pixels will be processed by an unsupervised classification.
Now my question, if the classes are close to their category in this case there is a risk of having a misclassification and hence we cannot have a reliable result? In this case how can I solve this problem?
In my case do I have to use a supervised learning method like the SVM method?
Because I think this method is not enough for me and I find it difficult to classify my regions since they are not homogeneous.

Thank you for your help.


Sorry if I was not clear about that, the learning model is supervised. By default the plugin uses a Random Forest, but you can choose the method you prefer in the Settings dialog.

You will have to include more samples (traces of each class) and play with the different features you can use. If you make an ideal manual segmentation of your image and post it here, I can help you find the best plugin configuration to replicate the result automatically.



Thank you for your reply.
I have three sample images:

My objective is to detect the region of greenery tiles on pictures and to calculate the area for these regions with analyze particles. In this way I will be able to compare between the green surface and the non-green surface.

Thank you for your help.


Do you want just orange/clay vs green? Maybe if you use 3 classes (clary, green, background)?


Sorry if I wasn’t clear about the choice of regions.

For each sample of my pictures, I would like to detect the different regions other than the original color of tiles where the microorganisms (algae, moss, lichens…) have growing.
That mean for the picture 1) and 2) I would like to separate the orange/red region from the others regions.
The same think for the last picture, I would like to separate the black color from the others regions.
After this segmentation will be done, I will be able to obtain the area for these regions and to compare them with the non-greening regions.

Thank you for your help



So, what about something like this?




I found a result some almost like yours; this may be due to the wrong choice in the segmentation method. Until now, I couldn’t know how to choose the best method for my problem. Could you help me please for the other images which are more complex to segment?


Can you post here an example of the traces and classes you use? That way I can see what problems they might have.