HOW TO REVERSE THE BINARY IMAGES

41 vues (au cours des 30 derniers jours)
mohd akmal masud
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?

Réponse acceptée

Matt J
Matt J le 20 Oct 2021
outt33(:,:,i) = ~imbinarize( I)
  1 commentaire
mohd akmal masud
mohd akmal masud le 20 Oct 2021
Tq Matt J, its work..

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Images dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by