I do recommend a classical method which is called Otsu's method. It is old (1979) but very effective and one of the standard methods in image processing. Take a look here:
http://web-ext.u-aizu.ac.jp/course/bmclass/documents/otsu1979.pdf and http://www.math.tau.ac.il/~turkel/notes/otsu.pdf.
You can apply it for global and local thresholding.
That depends on the local variability within your other images and the variability from one image to another. Do you want to apply a threshold in a batch? With the image you provided probably any threshold method lead to a satisfying result. K-means clustering may be a good choice if you have slight variabilties from one image to another. Good pre-processing also increases the outcome efficiency: top-hat transformation, background subtraction, local contrast enhancement, median-filtering... to mention few. Maybe you want to give a trainable classifier (weka) a shot. Weka is pre-installed as a plugin in Fiji and - if trained properly - can lead to a very accurate outcome. http://fiji.sc/Trainable_Weka_Segmentation
i appreciate your help. I could use otsu'method and I found the result that I wanted. I mean that otsu's method gives me a better result In comparison with other simple methods like im2bw(Img) . but can you guide me why outs'method works better when our image has intensity homogeneities.
I have a batch of these images and all of them have intensity homogeneities. a seris of scans .
you said: when my images have intensity homogeneities probably any threshold method lead to a satisfying result. why did you say this? it is the main thing that I want to know in this topic
Hello Atefeh Ghanbari, I probably misunderstood your question in the first place. As mentioned by others, otsu's method is suitable if there is a clearly distinguishable foreground and background. It is a standard method and usually gives satisfying results. I was confused because in your case there seem to be three clusters of three distinct grey-tones and I thought you want to seperate all of them individually. My first attachment shows the original image, its histogram and its edges (the arrows indicate the three clusters - note the fourth peak on the far-right of the histogram which comes from the white image border). The second image shows the chosen T (threshold value) of otsu's method - it separates the highest variance - peak one is assigned as being foreground and the other two peaks are considered background. If that is what you want, then you are good to go with otsu's method.
Global thresholding method is useful and enough when the background does not show local variation relative to the foreground (target) intensity. While local thresholding is necessary when there is local variation occur between the intensity difference of background and target.
In the image case you show in your question there is no local variation in the background for this reason I suggest you use global thresholding...
I came to this conclusion that I hope this will be true:
1.if our image has Intensity homogeneities, it means that it doesn't have local variation in both background and foreground...if we don't have local variation we can use global thresholding.
2. if we want to use global thresholding and there is clearly distinguishable foreground and background it means that Otsu's method can be successfull.
so for first result I can use global thresholding and for second result I can use Otsu's method.