Hello,
I've written a code in which a user has to click on the video while it is being played. Unfortunately, the readFrame() method is too slow. I came across the VideoFileReader and VideoPlayer method, but I can't seem to figure out how to put a figure handle to the VideoPlayer window… In my code, I created a handle using image(temp,'Parent',curr_axes), but I can't seem to do the same for videoPlayer. Can anybody help?
%Load file
clear all, close all, clc;fileList = dir('*.mp4');video_name = fileList.name;vid = VideoReader(video_name);curr_axes = axes;hfig = figure(1);%Use callback function to register any mouse clicks on the figure
set(hfig,'WindowButtonDownFcn',@countclicks)%Play video
framecount = 0;while vid.hasFrame() %Play video temp = vid.readFrame(); count = framecount + 1; image(temp,'Parent',curr_axes); if framecount == 1 figure(hfig); p2 = imellipse; vert_p2 = getVertices(p2); wait(p2); end pause(0.05/25);end
Best Answer