Plot part of sphere by binary map.

Hey i had binary map of aphere's net The map (180x360 matrix for az,el) cover 24% of the sphere and Represents Camera field of view. I want plot the sphere, only where the binary map are true. And where ita false to make no sphere (or sphere with transparency 100%, II add pic of the camera field of view (before make it binary map)

Answers (1)

What about plot3?
[x,y,z] = sphere(20);
[az,el] = meshgrid(200:5:250,0:5:20);
[x1,y1,z1] = sph2cart(az*pi/180,el*pi/180,1);
plot3(x1,y1,z1,'.r')
surface(x,y,z,'facecolor','none','edgecolor',[1 1 1]/2)
axis equal

3 Comments

Hey darova, thanks for help.
Maybe i wasn't clear, or i don't understand how can i use your code, i will try to explain more: I had this image (360,180) of some binary maps i combine:
When i plot it on sphere i get this:
I want the black part at the top of the aphere will be clear (100% transparency) so i can see the inside of the sphere...
The code i use:
if true
clc; clear all ;
I=load('camerasFOV.jpg') ;
[m,n] = size(I) ;
[X,Y,Z] = sphere(m-1,n-1);
surf(X,Y,Z,flipud(I),'FaceColor','texturemap','EdgeColor','none');
colormap(gray);
end
If u can help me with that i will be thankful.
DId you try to replace black pixels with NaN?
Hey Yes, i tried... It still plot the nan as black

Sign in to comment.

Asked:

on 18 Sep 2021

Commented:

on 20 Sep 2021

Community Treasure Hunt

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

Start Hunting!