www.gusucode.com > vision 源码程序 matlab案例代码 > vision/PlotColorSphericalPointCloudExample.m

    %% Plot Spherical Point Cloud with Texture Mapping
%% 
% Generate a sphere consisting of 600-by-600 faces.

% Copyright 2015 The MathWorks, Inc.

numFaces = 600;
[x,y,z] = sphere(numFaces);
%% 
% Plot the sphere using the default color map.
figure;
pcshow([x(:),y(:),z(:)]);
title('Sphere with Default Color Map');
xlabel('X');
ylabel('Y');
zlabel('Z');
%% 
% Load an image for texture mapping.
I = im2double(imread('visionteam1.jpg'));
imshow(I);
%% 
% Resize and flip the image for mapping the coordinates.
J = flipud(imresize(I,size(x)));
%% 
% Plot the sphere with the color texture.
pcshow([x(:),y(:),z(:)],reshape(J,[],3));
title('Sphere with Color Texture');
xlabel('X');
ylabel('Y');
zlabel('Z');