Video overlay over activeX object?

9 views (last 30 days)
Rob van de Pijpekamp
Rob van de Pijpekamp on 6 Dec 2012
I am using an activeX object (windows media payer) to show a video stream real-time.
I want to plo some lines over this video (does not have to be real time).
Is there a method to get plot over this activeX object?
With my code I can show individual frames or play the video real time using a GUI.
vhwmp.controls.pause and vhwmp.controls.play can be used to start and stop video playback
This is my code;
function showframe_wmp( MovieName1, time) %SHOWFRAME Summary of this function goes here % Detailed explanation goes here
if strfind(MovieName1,'Ch1')
%framenumber = min(framenumber, numframes);
set(0,'DefaultFigureMenu','none');
%Name=evalin('base','get(vh,''name'')');
vh_exist = evalin('base','exist(''vh'',''var'')');
if vh_exist==0
evalin('base',['if ~exist(''vh'',''var'')' ...
'vh=figure;' ...
'set(vh,''Position'',[38 421 707 292]);' ...
'set(vh,''Resize'',''off'');' ...
'set(vh,''name'',''',MovieName1,''');' ...
'vhwmp=actxcontrol(''WMPlayer.OCX.7'', [0 0 704 288], vh);' ...
'vhwmp.uiMode=''none'';'...
'[pathstr, name, ext, versn]=fileparts(VideoName1);' ...
'vhwmp.URL=[''Video\\'' name ext];'...
'pause(1);' ...
'vhwmp.controls.pause;' ...
'end']);
else
vh_handle = evalin('base','ishandle(vh)');
evalin('base',['if ~ishandle(vh)' ...
'vh=figure;' ...
'set(vh,''Position'',[38 421 707 292]);' ...
'set(vh,''Resize'',''off'');' ...
'set(vh,''name'',''',MovieName1,''');' ...
'vhwmp=actxcontrol(''WMPlayer.OCX.7'', [0 0 704 288], vh);' ...
'vhwmp.uiMode=''none'';'...
'[pathstr, name, ext, versn]=fileparts(VideoName1);' ...
'vhwmp.URL=[''Video\\'' name ext];'...
'pause(1);' ...
'vhwmp.controls.pause;' ...
'end']);
end
%evalin('base',['set(0,''CurrentFigure'',vh);'])
evalin('base',['vhwmp.controls.currentPosition=',num2str(time),';']);
evalin('base','step(vhwmp.controls,1);')
set(0,'DefaultFigureMenu','figure');
end

Answers (0)

Community Treasure Hunt

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

Start Hunting!