How to draw circles at the start of a video and display these circles again at specified framecounts?

1 回表示 (過去 30 日間)
Sam
Sam 2020 年 6 月 30 日
回答済み: darova 2020 年 7 月 1 日
Hello,
I am trying to write a program in which the user has to draw 5 ellipses at the beginning of the video. Is there a way I can display these drawn ellipses again at specified framecounts?
framecount = 0;
while vid.hasFrame() %Play video
temp = vid.readFrame();
framecount = framecount + 1;
curr_time(framecount) = vid.CurrentTime;
image(temp,'Parent',curr_axes);
if framecount == 1
disp('Draw 5 ellipses')
p1 = drawellipse;
wait(p1);
p2 = drawellipse;
wait(p2);
p3 = drawellipse;
wait(p3);
p4 = drawellipse;
wait(p4);
p5 = drawellipse;
wait(p5);
end
curr_axes.Visible = 'off';
pause(0.05/vid.FrameRate);
%Video of 2 minutes, pause every 4 seconds = 28 * 104 frames
if framecount == 104 || framecount == 104*2 || framecount == 104*3 || framecount == 104*4 ...
p6 = imrect; %Draw rectangle to proceed to the next 104 frames of the video
wait(p6);
end
end
I have to display the drawn ellipses again at framecount 104, 104*2, 104*3 and 104*4. Can anyone help?
Thank you.

回答 (1 件)

darova
darova 2020 年 7 月 1 日
You already wrote if statement for the first frame
if framecount == 1
Add another condition for each 5 frame
if framecount == 1 || mod(framecount,5) == 0

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by