Video overlay over activeX object?

조회 수: 8 (최근 30일)
Rob van de Pijpekamp
Rob van de Pijpekamp 2012년 12월 6일
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

답변 (0개)

카테고리

Help CenterFile Exchange에서 ActiveX에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by