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

조회 수: 2 (최근 30일)
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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by