HOW TO REVERSE THE BINARY IMAGES

조회 수: 42 (최근 30일)
mohd akmal masud
mohd akmal masud 2021년 10월 20일
댓글: mohd akmal masud 2021년 10월 20일
Hi all, First, I have 23 images labelled that I labelled foreground as 1 and background as 0 used groundTruthLabeler. Then I want to convert it as binary images.
%% first, read the labelled images from groundtrithLabeler.
clc
clear all
dataSetDir = fullfile('C:\Users\Akmal\Desktop\I-131 256 28.02.2020\I-131 SPECT NEMA VALIDATION 01112019 256X256 26.09.2021 petang');
imageDir = fullfile(dataSetDir,'labelledimages');
imds = imageDatastore(imageDir);
% view data set images origional
figure
for i = 1:23
subplot(5,5,i)
I = readimage(imds,i);
imshow(I==1)
title('training labels');
outt33(:,:,i) = imbinarize( I);
end
figure, imshow3D(outt33)
%%this one for convertlabelledimages to binary images
for k = 1:23
% dicomwrite(spect(:,:,k),sprintf('%d.dcm',k));
imwrite((outt33(:,:,k)), sprintf('%d.png',k));
end
SHOULD BE THE THE BACKGROUND IS 0 (BLACK) AND THE FOREGROUND IS 1 (WHITE)
BUT WHAT I GOT IS REVERSE, ANYONE CAN HELP ME?

채택된 답변

Matt J
Matt J 2021년 10월 20일
outt33(:,:,i) = ~imbinarize( I)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by