Import 2d image to 3d plot

조회 수: 10 (최근 30일)
Jared
Jared 2024년 11월 27일
댓글: Walter Roberson 2024년 12월 1일
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

채택된 답변

Walter Roberson
Walter Roberson 2024년 11월 27일
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
Jared
Jared 2024년 11월 30일
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 2024년 12월 1일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by