Draw growing circles on a jpeg file.

3 ビュー (過去 30 日間)
Ranjan Sonalkar
Ranjan Sonalkar 2017 年 10 月 20 日
コメント済み: Ranjan Sonalkar 2017 年 10 月 20 日
I have read in a jpeg file of a floor map. Now I want to draw a circle on it of time-dependent radius, so that it appears to be growing with time. I used the function viscircles. At a later time I want to go to a different position within the image and start drawing a new circle. But viscircles draws a filled circle that is persistent. How can I plot new circles and make the earlier circle go away. I could use cla every time I want a new circle, but that would require me to display the background image again. That would add processing time.

採用された回答

Jan
Jan 2017 年 10 月 20 日
編集済み: Jan 2017 年 10 月 20 日
You can remove the object by the delete command:
image(rand(640, 480, 3) * 0.5);
h = viscircles([200, 200], 5);
pause(1)
delete(h);
  1 件のコメント
Ranjan Sonalkar
Ranjan Sonalkar 2017 年 10 月 20 日
Thanks, works as I would like it to.

サインインしてコメントする。

その他の回答 (1 件)

Geoff Hayes
Geoff Hayes 2017 年 10 月 20 日
Ranjan - according to viscircles, if you do something similar to
hg = viscircles(ax,centers,radii)
then h is a handle to an hggroup object. As such, you should be able to hide these circles (if you wish by setting the Visible property to off, see hggroup properties) or you should be able to just delete this object
delete(hg)
The following example illustrates this
hg = hggroup;
x = -2*pi:0.4:2*pi;
y = sin(x);
line(x,y,'Parent',hg)
The sine curve is drawn and then we can delete is with
delete(hg)
  1 件のコメント
Ranjan Sonalkar
Ranjan Sonalkar 2017 年 10 月 20 日
Thanks, works as I would like it to.

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by