HOW TO REVERSE THE BINARY IMAGES

37 Ansichten (letzte 30 Tage)
mohd akmal masud
mohd akmal masud am 20 Okt. 2021
Kommentiert: mohd akmal masud am 20 Okt. 2021
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?

Akzeptierte Antwort

Matt J
Matt J am 20 Okt. 2021
outt33(:,:,i) = ~imbinarize( I)

Weitere Antworten (0)

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by