Import 2d image to 3d plot

7 visualizaciones (últimos 30 días)
Jared
Jared el 27 de Nov. de 2024
Comentada: Walter Roberson el 1 de Dic. de 2024
I have a 3d plot that I am making, but want to import a 2d image along the x and y axis only. I want to tuck the image into the corner where y=0 and x=0

Respuesta aceptada

Walter Roberson
Walter Roberson el 27 de Nov. de 2024
The major problem with mixing 3d plots with images, is that image() is a strictly 2D object -- images disappear quickly when tilted.
There are a few different ways you can proceed:
  • You can use hgtransform to transform the image in 3D to be perpendicular to whatever your viewing angle is. This would essentially rotate the image in 3D coordinates to be directly in the line of sight for your 3D view. The difficulty with this is that you would have to change the Matrix property each time you change the viewing angle.
  • You can surf() specifying 'FaceColor' of 'texturemap' and set CData to be your image.
  • You can use warp() which is a short-cut to using surf() with texturemapping
  2 comentarios
Jared
Jared el 30 de Nov. de 2024
What about just importing a simple 3D image into a 3D plot?
The file is an obj file.
Is there a way to consistently rotate the image at a specified frequency?
Walter Roberson
Walter Roberson el 1 de Dic. de 2024
The problem with importing a simple 3D image into a 3D plot, is that MATLAB has very few tools for handling 3D images. 3D images are volumes rather than being surfaces, and the "nearest" surface of the 3D image hides everything behind it, unless you have transparency set up.
You can use volshow to display 3D images, but it creates a hidden figure. The hidden figure has a single child of class Viewer . The Viewer object does have an Axes property, but the Axes property is class images.ui.graphics.internal.Axes which is not an axes that you can insert 3D content such as surf() onto.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by