how to calculated the total volume
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi all, I have code below, to put the rectangle on the circle of binary images.
%% TO GET THE VOLUME SEGMENTATION AFTER DEEP LEARNING PERFORM(blob all the sphere binary)
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=imerode(outt2,st2);
% outt22(:,:,ii) = imerode(outt2,st2);
title('output')
imshow(outt22)
% imshow(outt22(:,:,ii))
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
end
then I got this picture below
then I used code below to get the total area each circle
for i=1:4
zz=imcrop(outt22,allbb(i,:))
stats = regionprops('table',zz,'Centroid',...
'MajorAxisLength','MinorAxisLength')
T = regionprops('table', outt22,'Area','Centroid')
m1=stats.MajorAxisLength
m2=stats.MinorAxisLength
v1=stats.MinorAxisLength
vol=m1*m2*(v1/2)
ss=sprintf('the volume is %6f',vol)
msgbox(ss)
end
but its only calculated one of the images, how calculate all the sphere for all the images?
댓글 수: 0
채택된 답변
yanqi liu
2021년 10월 12일
%% TO GET THE VOLUME SEGMENTATION AFTER DEEP LEARNING PERFORM(blob all the sphere binary)
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=imerode(outt2,st2);
% outt22(:,:,ii) = imerode(outt2,st2);
title('output')
imshow(outt22)
% imshow(outt22(:,:,ii))
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
for i=1:4
zz=imcrop(outt22,allbb(i,:))
stats = regionprops('table',zz,'Centroid',...
'MajorAxisLength','MinorAxisLength')
T = regionprops('table', outt22,'Area','Centroid')
m1=stats.MajorAxisLength
m2=stats.MinorAxisLength
v1=stats.MinorAxisLength
vol=m1*m2*(v1/2)
ss=sprintf('the volume is %6f',vol)
msgbox(ss)
end
end
댓글 수: 4
추가 답변 (1개)
yanqi liu
2021년 10월 12일
vols = 0;
for i=1:4
zz=imcrop(outt22,allbb(i,:))
stats = regionprops('table',zz,'Centroid',...
'MajorAxisLength','MinorAxisLength')
T = regionprops('table', outt22,'Area','Centroid')
m1=stats.MajorAxisLength
m2=stats.MinorAxisLength
v1=stats.MinorAxisLength
vol=m1*m2*(v1/2)
vols = vols + vol;
end
ss=sprintf('the volume is %6f',vols)
msgbox(ss)
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Data Workflows에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!