Plot sphere region by given binary map.

조회 수: 6 (최근 30일)
sarel aharoni
sarel aharoni 2021년 9월 20일
답변: Gautam 2024년 5월 22일
Hey I try to build code that make 3d plot of sphere's part according to given 180x360 binary map (azimuth and elevation). As the example in this image:
I try use this code:
if true
clc; clear all ;
I = imread('viewmap.bmp') ;
[m,n] = size(I) ;
[X,Y,Z] = sphere(m-1,n-1) ;
surf(X,Y,Z,flipud(I),'FaceColor','texturemap','EdgeColor','none');
end
But i got the black area plot as black instead if grid plot .... Anyone can help me with that? Thanks alot.
  댓글 수: 2
darova
darova 2021년 9월 20일
I don't understand the question. You have problem with surface?
sarel aharoni
sarel aharoni 2021년 9월 20일
I had the bw map And i wanna plot the sphere with surface only in the white area like in the picture above.

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

답변 (1개)

Gautam
Gautam 2024년 5월 22일
Hello Sareal
I understand that you want to project the white area of the binary image on a sphere.
The reason you get the sphere black, and the projected area white in color is because the code you have provided uses the binary image as the color data which has values of either 0 or 1.
To get the plot as shown in the image you have posted, you can use the ‘mesh’ function to plot the sphere as a mesh plot and plot the projection as a surface plot using the ‘surf’ function.
Below is the result of this process and the binary image used for the projection
You can refer to the following MathWorks documentation for more information on the ‘mesh’ function
Thank You
Gautam Murthy

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by