HOW TO REVERSE THE BINARY IMAGES
41 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
mohd akmal masud
le 20 Oct 2021
Commenté : mohd akmal masud
le 20 Oct 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?
0 commentaires
Réponse acceptée
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!