how to integrate a automatic thresholding in my code?

조회 수: 6 (최근 30일)
Asif Hasan
Asif Hasan 2014년 6월 13일
댓글: Image Analyst 2014년 6월 15일
I have a code that can manually define thresholding value . I want to integrate a automatic thresholding in my code so that it can define thresholding value based on the image. Please help anyone ... this is my code ...Waiting for your replay......

답변 (2개)

Image Analyst
Image Analyst 2014년 6월 13일
The algorithm that woudl be best to use depends on your image. There is not one algorithm that works perfectly for all images, not even graythresh().
  댓글 수: 2
Image Analyst
Image Analyst 2014년 6월 13일
Asif's "Answer" moved here since it's not an answer to his original post:
Thanks for reply. But if i want to define automatic thresholding value based on every image . That will be better. Is there any way to do that?
Image Analyst
Image Analyst 2014년 6월 13일
Yes, there are lots of ways. I like triangle methods. For some images with bimodal histograms (objects on a uniform background) the Otsu method given by graythresh() works okay. You can also try multithresh() and imquantize().
Whether an automatic threshold is best depends on your images. If you have good control over your illumination conditions, it's quite possible that a fixed threshold will work while an algorithm that forces it to find some threshold will fail. For example if you have bright parts on a uniform background, Otsu might work find if there are one or more parts in the image. But if the image is 100% parts or 0% parts, then whatever threshold it finds will be wrong. In that case a fixed threshold is the way to go. Attach 3 of your images if you want advice.

댓글을 달려면 로그인하십시오.


Asif Hasan
Asif Hasan 2014년 6월 15일
In the source code , if i run for this image this algorithm don't work properly
Then if i run through this image it's output show 3 part's of white for the problem of brightness of the image
And there are some other images that don't give my desire output . So what you suggest me to do?

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by