0

I am going to plot a dynamic image (moving, rotating) within a MATLAB figure. How can I do that?

I know that for embedding an image in MATLAB i should use this code:

I = imread('image.jpg');

figure;

hold on;

image([-1 1],[1 -1],I);

How to draw the image by indicating its center position and its scale. How to move / rotate it?

Also, is there a way to plot the object with its background transparent?

Community
  • 1
  • 1

1 Answers1

0

Here is an example to start with,

This is the simplified code in here.

load topo
n = size(topomap1,1);
topo = (topo - min(topo(:))) ./ range(topo(:));
I = ind2rgb(round(topo*(n-1)+1), topomap1);
[X,Y,Z] = sphere(n);
for i = 1 : n
    [az,el,r] = cart2sph(X,Y,Z);
    az = az + 2 / n * pi;
    [X,Y,Z] = sph2cart(az,el,r);
    warp(X,Y,Z,I)
    axis equal off
    pause(.1)
end

enter image description here

You can change I to any image, like I = imread('peppers.png');

Also you can change the surface to any (see here).

Community
  • 1
  • 1
Rashid
  • 4,326
  • 2
  • 29
  • 54