How to use threshold in this problem?

조회 수: 1 (최근 30일)
muhammad ismail
muhammad ismail 2015년 1월 23일
댓글: Alessandro Masullo 2015년 1월 23일
I convert this picture into bw using c=im2bw(b,graythresh(b)); but the problem is the straight line is disconnected as picture below. It supposed to be straight single line. What kind of segmentation technique that I need to use?

채택된 답변

Alessandro Masullo
Alessandro Masullo 2015년 1월 23일
Supposed your image varies from o to 1, you could use a threshold in this way:
THR = 0.5
above = image>=THR;
image(above) = 1;
image(~above) = 0;
  댓글 수: 6
muhammad ismail
muhammad ismail 2015년 1월 23일
편집: muhammad ismail 2015년 1월 23일
Ok now I understood. Thank you very much for your great explanation. By the way I have last question for you. How to display gray level like image above. Sorry I'm newbie in matlab.
Alessandro Masullo
Alessandro Masullo 2015년 1월 23일
I just used imagesc(c). You can use different colormaps instead of the grey levels, use:
colormap jet
help colormap

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

추가 답변 (1개)

Image Analyst
Image Analyst 2015년 1월 23일
Like I said in your duplicate post, you can use imclearborder() and bwareaopen(), though there are better ways like background correction.

Community Treasure Hunt

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

Start Hunting!

Translated by