how to convert image to binary based on histogram

3 ビュー (過去 30 日間)
Jessica
Jessica 2011 年 12 月 18 日
I need help in converting an image to binary based on histogram. is there a function to do that in matlab? I know there is a function called im2bw(image, thresholdLevel) I could use that but how do I get the level? do I choose something from the histogram?
Thanks

回答 (2 件)

Image Analyst
Image Analyst 2011 年 12 月 18 日
  1 件のコメント
Jessica
Jessica 2011 年 12 月 18 日
I thought so also. thank you for the quick reply :)

サインインしてコメントする。


Avishek
Avishek 2011 年 12 月 18 日
there are several means of automatic thresholding. kmeans, ostu are the most popular if you want to do the thresholding manually
1) plot the histrogram using imhist()
2) find the point in the x-axis of histrogram that seems to divide the histrogram into two parts
if u choose to do it automatically
1) graythresh() gives you ostu thresholding
2)kmeans(), for clustering, this function has various options. you can modify it a bit to get what type of threshold you want.
  1 件のコメント
Jessica
Jessica 2011 年 12 月 19 日
thank you :)

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeHistograms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by