how to convert pixel value to 0 and 1 only or (0 and 255) only?
Show older comments
I tried to used (rgb2gray) and (imbinarize) for each image but I cannt get only 1 and 0 value , still have 148 and others
how to fix it?
3 Comments
All the values are either 0 or 1.
What makes you think they are not?
im = imread('Label7027_157.png');
im_gray = rgb2gray(im);
im_bin = imbinarize(im_gray);
all(ismember(im_bin,[0 1]),'all')
yasmin ismail
on 15 Oct 2023
Edited: Walter Roberson
on 15 Oct 2023
Image Analyst
on 15 Oct 2023
Don't call imread (you already did that) and don't put quotes around im_bin2 in this line:
BW_groundTruth = imread('im_bin2');
Do this instead:
BW_groundTruth = im_bin2;
Accepted Answer
More Answers (0)
Categories
Find more on Language Support 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!