how to place the rectangle for all the blob
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
mohd akmal masud
el 11 de Oct. de 2021
Comentada: Star Strider
el 12 de Oct. de 2021
Hi all,
I have 7 binary images.
anyone know how to place the rectangle for all the blob in the subplot binary images?
I used below coding, but only one binary image (the last images) have the rectangle
%% TEST IMAGES
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,'Test');
IMDS = imageDatastore(IMAGEDir);
%% TO GET THE VOLUME SEGMENTATION AFTER DEEP LEARNING PERFORM
alldice=[]
acc=[]
Ts = [];
Ts2 = [];
for ii=1:7
subplot(3,3,ii)
I = readimage(IMDS,ii);
[C,scores] = semanticseg(I,net1);
outt2=C=="foreground";
st2=strel('disk',5);
outt22 = imopen(outt2,st2);
figure
title('output')
imshow(outt22)
fprintf('\nprocess %d image\n', ii);
T = regionprops('table', outt22,'Area','Centroid');
info = regionprops(outt22,'Boundingbox') ;
Ts{ii} = T;
Ts2 = [Ts2; T];
end
allbb=[]
for k = 1 : length(info)
BB = info(k).BoundingBox;
rectangle('Position', [BB(1),BB(2),BB(3),BB(4)],'EdgeColor','r','LineWidth',1) ;
allbb=[allbb; BB]
end
0 comentarios
Respuesta aceptada
DGM
el 11 de Oct. de 2021
The second loop needs to be inside the first one, otherwise it's only going to plot the bounding boxes for the blobs in the last subplot.
7 comentarios
Star Strider
el 12 de Oct. de 2021
‘T’ is a table, and the ‘T.Area’ reference returns the values in the ‘Area’ variable as a column vector.
.
Más respuestas (1)
yanqi liu
el 12 de Oct. de 2021
%% TEST IMAGES
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,'Test');
IMDS = imageDatastore(IMAGEDir);
%% TO GET THE VOLUME SEGMENTATION AFTER DEEP LEARNING PERFORM
alldice=[]
acc=[]
Ts = [];
Ts2 = [];
for ii=1:7
I = readimage(IMDS,ii);
[C,scores] = semanticseg(I,net1);
outt2=C=="foreground";
st2=strel('disk',5);
outt22 = imopen(outt2,st2);
figure(ii)
title('output')
imshow(outt22)
fprintf('\nprocess %d image\n', ii);
T = regionprops('table', outt22,'Area','Centroid');
info = regionprops(outt22,'Boundingbox') ;
Ts{ii} = T;
Ts2 = [Ts2; T];
end
allbb=[]
for ii=1:7
figure(ii);
hold on;
for k = 1 : length(info)
BB = info(k).BoundingBox;
rectangle('Position', [BB(1),BB(2),BB(3),BB(4)],'EdgeColor','r','LineWidth',1) ;
allbb=[allbb; BB]
end
end
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!