what should I do so that only gray image converts into binary , not the black backgroung while moving the threshold.

2 views (last 30 days)
Dear Image analyst , I have a gray image ( a selected ROI) displayed in a black background screen. I am trying to use your adjustable threshold method to convert this gray image into binary.while moving the threshold cursor to convert this gray image into binary image , the black background is also changing from black to white and is including into total pixel calculations and in histogram. But I want only my ROI to convert from gray to binary not the background.

Accepted Answer

Image Analyst
Image Analyst on 24 Jan 2014
Just change your thresholds. Instead of going from 0 to 150, go from 150 to 255. If that's not right, post a screenshot and describe it in more detail.
  6 Comments
MD
MD on 1 Feb 2014
Dear Image Analyst
Thank you very much for your kind help. I have calculated the no. of black and white pixels correctly with the help of your codes. I have only one problem right now , that is the big spike of black background that displays at gray level 17. As you advised before , there is a radio button to display log or linear in histogram . but I dont have the update version of your threhold method.If you think the updated version can help me to suppress the big spike of black background and will display mainly the object , please send the the updated version. So kind of you sir. thanks.

Sign in to comment.

More Answers (0)

Categories

Find more on Convert Image Type in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!