How to make the grey area completely black, so it's a binary image?

조회 수: 1 (최근 30일)
Tawsif Mostafiz
Tawsif Mostafiz 2022년 4월 16일
답변: DGM 2022년 4월 16일
Hi, I have a grayscale tumor image like this:
I want to make the grey area complely dark, something like this:
(This is a mask for another image)
so that the white area remailns white, but the grey area goes dark. Is it possible?

채택된 답변

Tala
Tala 2022년 4월 16일
편집: Tala 2022년 4월 16일
you mean you want to have the whole tumor area white and the rest of the image black? just threshold your image
I=imread('image.bmp');
I2=I>250;
imshowpair(I2,I,'montage')

추가 답변 (1개)

DGM
DGM 2022년 4월 16일
The mask that was used to create the hole in the image is the binarized image. You shouldn't need to turn the source image into a copy of the mask.
but if you must:
A = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/966480/image.bmp');
A(A<255) = 0;
imshow(A)

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by