Animate Image over background by a deffined curve.

2 views (last 30 days)
Hello, I think of way how to animate a car moving by a user deffined curve. I have the matrix X,Y cordinates of the curve. I tried a few ways. For example to make a new axis over the old one with the background. But when I start animation the car moves by a strange curve. The curve is obviosly the same but it is moved. here is some code:
for n=1:1:numel(X)
set(newAxes,'position',[X(n) Y(n) 0.045 0.027])
pause(0.1)
drawnow
n = n+1;
end
With this code the car moves by a shifted curve. I suppose this is because position is measured in the rectangle [0 0 1 1]. Can I some how use this axes over axes to create the required animation?
Another aproach is:
Image1(row1:row2, col1:col2) = imrotate(Image2,-90,'bilinear','crop'); imshow(Image1); where i put the car image over the background. But I can't further animate it... It would be nice if some one could help me with some examples! Thank you.

Answers (0)

Categories

Find more on Animation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!