Effacer les filtres
Effacer les filtres

How can I extract each connected object in a 3D array?

2 vues (au cours des 30 derniers jours)
May
May le 1 Mar 2017
Commenté : Image Analyst le 2 Mar 2017
I have a 3D array (attached as Y.mat) and I find the connected components using bwconncomp. I used the following coding to extract each component but X is a zero array with the same size as Y. Please, help me to solve this problem.
Thanks
May
CC = bwconncomp(Y, 26); % Y is the 3D array
L = labelmatrix(CC);
for i=1:length(CC.PixelIdxList)
X = (L==i);
imshow3D(a); % use existing function to show 3D
end

Réponse acceptée

Image Analyst
Image Analyst le 1 Mar 2017
Use ismember
oneBlobOnly = ismember(L, i);
  2 commentaires
May
May le 2 Mar 2017
Thanks Image Analyst,I tried it but the result is not change. Please kindly help me , where I made wrong. Thank you so much again.
load Y;
CC = bwconncomp(Y, 26); % Y is the 3D array
L = labelmatrix(CC);
oneBlobOnly = ismember(L,2);
map = hsv(90);
XR = oneBlobOnly; %%If I show "Y", it can show.
Ds = smooth3(XR);
hiso = patch(isosurface(Ds,5),'FaceColor','blue','EdgeColor','none');
hcap = patch(isocaps(XR,5),'FaceColor','interp','EdgeColor','none');
colormap(map)
daspect(gca,[1,1,.4])
lightangle(305,30);
fig = gcf;
fig.Renderer = 'zbuffer';
lighting phong
isonormals(Ds,hiso)
hcap.AmbientStrength = .6;
hiso.SpecularColorReflectance = 0;
hiso.SpecularExponent = 50;
ax = gca;
ax.View = [215,30];
ax.Box = 'On';
axis tight
title('One Blob');
Image Analyst
Image Analyst le 2 Mar 2017
You forgot to attach Y.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Images dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by