Figure with image mapped to spherical background

조회 수: 18 (최근 30일)
Daire Vickers
Daire Vickers 2021년 5월 12일
답변: Image Analyst 2021년 9월 10일
Hi, I am trying to make a 3-D plot which has a spherical background image. I have tried making a larger sphere that an image is mapped to, and then placing the other data to be plotted inside this sphere, and placing the camera inside the sphere. However when I do this the the figure displays as a circle, rather than the background image filling up the whole square area of the figure.
I have:
and my code is:
axis([-10 10 -10 10 -10 10])
[x,y,z]=sphere(50);
spherescale=10;
hold on
U_im=imread('esoMilkyway.jpg'); % Import texture data for Universe
Bg=surf((x*spherescale),(y*spherescale), (z*spherescale));
set(Bg,'facecolor','texturemap','cdata',U_im,'edgecolor','none');
daspect([1 1 1]);
campos([1 0 0]);
axis off
The effect that I am trying to reproduce can be seen at 20:45 in this video: https://uk.mathworks.com/videos/modeling-and-simulation-with-matlab-a-case-study-in-problem-based-learning-90422.html I'm sure I am just missing a simple solution but I have done lots of research on google and I can't find any examples of what I am trying to do.
Also, when I rotate the figure the camera moves itself out of the sphere which is also something I would like to stop happening. If anyone can help me out that would be greatly appreciated. Thanks!
  댓글 수: 7
Daire Vickers
Daire Vickers 2021년 5월 21일
편집: Daire Vickers 2021년 5월 21일
Thank you guys for your help, I just realised that in the image I shared the camera view angle is 170 degrees and thats why it looks weird. Adam I will review that documentation, it looks like it will be helpful as well! The image I am using is from here: https://www.eso.org/public/images/eso0932a/ and I have used it as a texture map for a sphere to be a spherical background.

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

답변 (2개)

Tiago Padovan
Tiago Padovan 2021년 9월 10일
Any update in this matter? I just started facing the same issue.
I have an animation where the camera rotates around the ISS (which I obtained from an STL file).
When I try adding an oversized sphere with the image of the night sky covering it and plot the other elemrnts inside it, it does not work. The image of the stars appears and it actually rotates as expected from a backgorund (oposite to the objects' rotation), but the objects insite are not visible...

Image Analyst
Image Analyst 2021년 9월 10일
See the examples in the documentation for pcshow() in the Computer Vision Toolbox.

카테고리

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

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by