Import 2d image to 3d plot

9 ビュー (過去 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 Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by