Question

In MATLAB one could do something like this to handle mouse clicks in image axis of a Figure

frame = imread('image.jpeg');
imHandle = imshow(frame);
set(imHandle, 'ButtonDownFcn', {@onclick, gca}); % @onclick is callback function

However, I'm using video player from Computer Vision System toolbox. For example,

videoPlayer = vision.VideoFileReader(filename, 'VideoOutputDataType', 'uint8');
for i=1:1:10 
    frame = mov(i).cdata;      % read frame from a movie structure
    step(videoPlayer, frame);  % Original video
end

Essentially, I would like to write mouse-click callbacks for a vision.VideoPlayer object, in the same manner as for a MATLAB handle graphics object. The call back function could return, for example, the position of the click within the video. I didn't find examples for this on MathWorks website. Is this possible with vision.VideoPlayer objects?

Was it helpful?

Solution

Per MATLAB support. The vision.VideoPlayer object is actually a handle graphics object. There is an undocumented and unsupported command by which we can obtain its handle:

findall(0, 'type', 'axes', 'tag', 'VideoAxes')

Note that altering the handle graphics properties of the video.VideoPlayer object may cause unexpected behavior, and that doing this is not a supported feature.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top