how to put the image that is sky background in the 3D axes in plot

please help me with 'how to put the image of sky to background of 3D axis, in the graph what i have plotted'.

2 comentarios

How should the image move when you change the viewpoint?
Is it necessary that the image be part of the same 3D axis, or could it be a different axis that is visually "behind" the 3D axis?
Or, do you just want a sky blue background to the plot instead of the default white?

Iniciar sesión para comentar.

Respuestas (1)

You can show an image in 3D using surf
I = imread('cameraman.tif');
[X Y] = meshgrid(1:size(I,1), fliplr(1:size(I,2)));
surf(X, ones(size(I)), Y, I,'EdgeColor','none')
or
surf(X, Y, ones(size(I)), I,'EdgeColor','none')
or
surf(ones(size(I)), X, Y, I,'EdgeColor','none')

1 comentario

Yes, you can use surf like this. It's a bit more efficient to do something like this though:
I = imread('cameraman.tif');
z_off = -10;
X = [1 size(I,2)];
Y = [size(I,1) 1];
Z = z_off + zeros(2);
surf(X,Y,Z,I,'FaceColor','texture','EdgeColor','none')
That results in a surface which only has 4 vertices, rather than one with 1 vertex for each pixel, which is what you get if you make X,Y, & Z the same size as I.
Also, starting in R2014b, you can use image in 3D. The tricky bit is that the image object doesn't have Z coordinates. But you can use hgtransform to move it to the location you'd like.
g = hgtransform;
image(I,'Parent',g)
axis ij
g.Matrix = makehgtform('translate',[0 0 z_off]);

Iniciar sesión para comentar.

Categorías

Más información sobre Object Containers en Centro de ayuda y File Exchange.

Preguntada:

el 30 de Nov. de 2015

Comentada:

el 30 de Nov. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by