Dear All,
As the question suggests, I need to know how to clear the background image after I plotted the interpolated curve.
if true
rgb = imread('leaf.jpg');
figure
imshow(rgb);
axis([0 500 0 500]);
hold on;
xy = [];
disp('Left mouse button picks points.')
disp('Right mouse button picks last point.')
p = 1; %Loop flag
n = 0; %Incrementer for points.
while p == 1
[xi,yi,p] = ginput(1);
plot(xi,yi,'ro')
n=n+1;
xy(:,n) = [xi,yi];
end
%Interpolate with a Spline curve.
t = 1:n;
ts = 1:0.1:n;
xys = spline(t,xy,ts);
% Plot the interpolated curve.
plot(xys(1,:),xys(2,:),'b-');
hold off
clf(rgb)
% code
end
Thanks to all! :)

 Réponse acceptée

Image Analyst
Image Analyst le 29 Oct 2013

0 votes

Not sure what that means, but you can use delete() or clear() to get rid of variables.

1 commentaire

Susie
Susie le 29 Oct 2013
I think I got it :) Thank you though!
I'm basically putting an image on a plot, then taking points, then using spline() and ginput() I can play connect the dots and get a curve that fits the points where I clicked. Just needed the image to disappear so I can have just the final curve.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Interpolation dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by