Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 工程数学软件 > MATLAB论坛
MATLAB论坛 一切MATLAB相关问题在此讨论。
 
 
主题工具 显示模式
旧 2009-01-08, 01:04   #7
monkeygk
初级会员
 
注册日期: 2008-12-26
年龄: 42
帖子: 3
声望力: 0
monkeygk 正向着好的方向发展
默认 回复: 请问:在matlab中,如何实现在暂停播放视频后,继续播放视频?

這是可以啟動跟停止的
我把原碼全都貼上了
你試試看囉~


function varargout = myCameraGUI(varargin)
% MYCAMERAGUI M-file for myCameraGUI.fig
% MYCAMERAGUI, by itself, creates a new MYCAMERAGUI or raises the existing
% singleton*.
%
% H = MYCAMERAGUI returns the handle to a new MYCAMERAGUI or the handle to
% the existing singleton*.
%
% MYCAMERAGUI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in MYCAMERAGUI.M with the given input arguments.
%
% MYCAMERAGUI('Property','Value',...) creates a new MYCAMERAGUI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before myCameraGUI_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to myCameraGUI_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help myCameraGUI

% Last Modified by GUIDE v2.5 14-Apr-2004 10:30:43

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @myCameraGUI_OpeningFcn, ...
'gui_OutputFcn', @myCameraGUI_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin & isstr(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before myCameraGUI is made visible.
function myCameraGUI_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to myCameraGUI (see VARARGIN)

% Choose default command line output for myCameraGUI
handles.output = hObject;

% Create video object
% Putting the object into manual trigger mode and then
% starting the object will make GETSNAPSHOT return faster
% since the connection to the camera will already have
% been established.
handles.video = videoinput('winvideo', 1);
set(handles.video,'TimerPeriod', 0.05, ...
'TimerFcn',['if(~isempty(gco)),'...
'handles=guidata(gcf);'... % Update handles
'image(getsnapshot(handles.video));'... % Get picture using GETSNAPSHOT and put it into axes using IMAGE
'set(handles.cameraAxes,''ytick'',[],''xtick'',[]),'... % Remove tickmarks and labels that are inserted when using IMAGE
'else '...
'delete(imaqfind);'... % Clean up - delete any image acquisition objects
'end']);
triggerconfig(handles.video,'manual');

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes myCameraGUI wait for user response (see UIRESUME)
uiwait(handles.myCameraGUI);


% --- Outputs from this function are returned to the command line.
function varargout = myCameraGUI_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
handles.output = hObject;
varargout{1} = handles.output;


% --- Executes on button press in startStopCamera.
function startStopCamera_Callback(hObject, eventdata, handles)
% hObject handle to startStopCamera (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Start/Stop Camera
if strcmp(get(handles.startStopCamera,'String'),'Start Camera')
% Camera is off. Change button string and start camera.
set(handles.startStopCamera,'String','Stop Camera')
start(handles.video)
else
% Camera is on. Stop camera and change button string.
set(handles.startStopCamera,'String','Start Camera')
stop(handles.video)
end
monkeygk 当前离线   回复时引用此帖
 


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛启用 表情符号
论坛启用 [IMG] 代码
论坛禁用 HTML 代码


相似的主题
主题 主题作者 版面 回复 最后发表
[求助]跪求lena.bmp图 kaka380447486 MATLAB论坛 2 2012-03-18 22:29
[求助]直流电机的双闭环调速系统 非儿 MATLAB论坛 1 2008-05-23 23:04
【求助】图像标准差计算 inneryiyun MATLAB论坛 1 2008-02-25 08:37
Tips and Tricks - Checking Your Model with Simulink Model Advisor TechnicalArticles MATLAB技术文章 0 2008-01-06 16:32


所有时间均为北京时间。现在的时间是 21:25


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.