MATLAB: How to superimpose or overlay two images on the surface of a sphere in MATLAB 7.5 (R2007b)

MATLABoverlapoverlappingsuperposesuperposition

I am trying to produce a superimposition of two images on the surface of a sphere. I wish to see both images transparently. How can I do it?

Best Answer

A single sphere can have only one image matrix displayed on its surface (as its CData property). However, the superimposition of two or more images can be done by placing two or more spheres transparently at the same location. The following example demonstrates this.
% construct the first sphere and get its surface
figure; sphere;
axis equal; view([170 -30]);
sph1 = findobj('Type', 'surface');
% read first image and apply it transparently
im1 = imread('pout.tif');
set(sph1, 'CData', im1, 'FaceColor', 'texturemap', 'FaceAlpha', 0.5);
% construct second sphere at same location and
% find the new surface (it will have default transparency of 1)
hold on; sphere;
sph2 = findobj('Type', 'surface', 'FaceAlpha', 1);
% read second image and apply it transparently
im2 = imread('cameraman.tif');
set(sph2, 'CData', im2, 'FaceColor', 'texturemap', 'FaceAlpha', 0.5);
hold off;