How do I superimpose or overlay two images on the surface of a sphere in MATLAB 7.5 (R2007b)?

1 view (last 30 days)
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?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
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;

More Answers (0)

Products


Release

R2007b

Community Treasure Hunt

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

Start Hunting!