How to display an image in 3D cordinate axes ?
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I want to display this image in 3D cordinate system with x,y and z axes. Pls. help me out.
Attached below is the image in question. It is a 3D image 780x1040x3 size.
0 commentaires
Réponses (1)
ANKUR KUMAR
le 13 Juil 2021
It is not really a 3D image. The third dimension has the RGB values. That is why you can able to see the color image.
Let's see this example.
A=imread('peppers.png');
size(A)
A is a 3D matrix, but RGB values are stored along the third dimension.
imshow(A)
If you plot using only the X and Y coordinate, you would get like this in each of the third dimension.
imshow(A(:,:,1))
imshow(A(:,:,2))
imshow(A(:,:,3))
The combination of these three images results into a color image.
2 commentaires
ANKUR KUMAR
le 13 Juil 2021
X, Y and Z are just the sequence of numbers from 1 to the size along that dimension.
A=imread('peppers.png');
size(A)
imshow(A)
These would be your coordinates of image.
X=[1:size(A,1)];
Y=[1:size(A,2)];
Z=[1:size(A,3)];
Above are the X, Y and Z coordinates of the image. You can plot it using contourf function giving corrdinates as arguments.
figure
for index=1:3
subplot(2,2,index)
contourf(Y,X,A(:,:,index),'linecolor','none')
set(gca,'Ydir','rev')
daspect(ones(1,3))
title(index)
end
If you want to crop the image, you can use these dimension to crop it, followed by using imshow or contourf as per your need.
figure
for index=1:3
subplot(2,2,index)
contourf(Y(400:510),X(200:325),A(200:325,400:510,index),'linecolor','none')
set(gca,'Ydir','rev')
daspect(ones(1,3))
title(index)
end
subplot(2,2,4)
imshow(A(200:325,400:510,:))
Voir également
Catégories
En savoir plus sur Communications Toolbox 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!