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.
0 个评论
回答(1 个)
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
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!