3d Plot “pile up 100 2d images” in 3d plane
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
shubham kumar gupta
le 12 Jan 2021
Commenté : Bjorn Gustavsson
le 12 Jan 2021
3d PLOT 100 2d images pile up one above other MATLAB
I have 100 matrixes each with order 360*360
i.e a(1) to a(100)
%a(1)=360x360
K = mat2gray(a(1))
imagesc(K) #PLOTTED a 2d image
What I want is to pile up all 100 images on top of each other in 3d plot
My attempt
I thought adding a third axis to matrix would work with z as 1,2,...100 [say hieght]
like a(1,1,i)=i to a(360,360,i)=i //where i is height in z axis so at each z one 2d image
for i = 1:100
l = data(:,i);
a100(:,:,i) = reshape(l, 360, []);
end
finally I have a1=360x360x100 now I want to plot them all
0 commentaires
Réponse acceptée
Bjorn Gustavsson
le 12 Jan 2021
Modifié(e) : Bjorn Gustavsson
le 12 Jan 2021
You can use the function slice (see the help and documentation for details), but to do that you'll have to use 3-D arrays as input - that is you'll have to put your individual images into a 3-D array, something like this:
Iall3D(:,:,100) = a100; % it is not entirely clear what data-type your a is
... etc
Then you can use slice:
x = 1:size(Iall3D,2);
y = 1:size(Iall3D,1);
z = 1:size(Iall3D,3);
slice(x,y,z,Iall3D,[],[],1:10:100),shading flat
Or you can use the surf function and display the images manually:
[X,Y] = meshgrid(x,y);
Z = 1:100;
for iZ = 1:numel(Z),
surf(X,Y,Z(iZ)*ones(size(X)),Iall3D(:,:,iZ)),shading flat
hold on
end
You will have some significant problems with closely overlapping slices hiding the layers behind, but that's something you'll have to adjust to suit your needs and data. Sometimes is is possible to get somewhere using the transparency properties of the surfaces to make them slightly transparent (that should be the "alpha***" properties, for using this you'll have to call surf with an output to get the handle to the surfaces, and then get and set to modify these properties.)
HTH
2 commentaires
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!