HOW TO REVERSE THE BINARY IMAGES

38 visualizaciones (últimos 30 días)
mohd akmal masud
mohd akmal masud el 20 de Oct. de 2021
Comentada: mohd akmal masud el 20 de Oct. de 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?

Respuesta aceptada

Matt J
Matt J el 20 de Oct. de 2021
outt33(:,:,i) = ~imbinarize( I)

Más respuestas (0)

Categorías

Más información sobre Images en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by