Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
初级会员
注册日期: 2008-04-10
年龄: 40
帖子: 9
声望力: 0 ![]() |
![]()
请教在matlab中,如何实现在暂停播放视频后,继续播放视频?
暂停是通过pause函数来实现的,那请问实现继续播放更如何实现呢? 请高手指点。 谢谢 |
![]() |
![]() |
![]() |
#2 |
初级会员
注册日期: 2008-04-10
年龄: 40
帖子: 9
声望力: 0 ![]() |
![]()
我想通过循环播放视频帧的形式实现播放、暂停、继续的功能
现在播放、暂停的功能实现了 播放是通过按第一个按钮采用循环播放的步骤实现: mov=aviread('1.avi'); lm=size(mov,2);%影片的长度 tmp=1; for i=tmp : lm %逐帧播放视频文件 ff=mov(i);%得到视频文件的第i帧 movie(ff,1,30);%播放视频文件的第i帧 nmf=i;%存放当前的视频帧 end 暂停是通过第二个按钮实现的: pause; 现在的问题是第三个按钮实现继续的时候,出来问题: lm=size(mov,2);%影片的长度 %从暂停之后的下一帧开始播放 tmp=nmf+1;%暂停之后的下一帧 for i=tmp : lm %逐帧播放视频文件 ff=mov(i);%得到视频文件的第i帧 movie(ff,1,30);%播放视频文件的第i帧 nmf=i;%存放当前的视频帧 end 按下去之后,没有反应。 请问是那句代码与问题? |
![]() |
![]() |
![]() |
#3 |
初级会员
注册日期: 2008-04-10
年龄: 40
帖子: 9
声望力: 0 ![]() |
![]()
此时还有一个问题,就是在暂停之后,再次按第一个按钮实现正常播放时,也没有反应。
|
![]() |
![]() |
![]() |
#4 |
初级会员
注册日期: 2008-04-10
年龄: 40
帖子: 9
声望力: 0 ![]() |
![]()
也就是怎样取消暂停呢?可以通过按钮执行什么命令实现吗?
我试过按下任意键可以继续播放, 那在gui界面该如何实现继续播放呢? |
![]() |
![]() |
![]() |
#5 |
初级会员
注册日期: 2008-04-10
年龄: 40
帖子: 9
声望力: 0 ![]() |
![]()
很希望路过的高手不要吝惜赐教。
谢谢 |
![]() |
![]() |
![]() |
#6 |
初级会员
注册日期: 2008-12-19
年龄: 35
帖子: 1
声望力: 0 ![]() |
![]()
有知道答案的吗?求啊!!!!!!!!
|
![]() |
![]() |
![]() |
#7 |
初级会员
注册日期: 2008-12-26
年龄: 42
帖子: 3
声望力: 0 ![]() |
![]()
這是可以啟動跟停止的
我把原碼全都貼上了 你試試看囉~ 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 |
![]() |
![]() |
![]() |
主题工具 | |
显示模式 | |
|
|
![]() |
||||
主题 | 主题作者 | 版面 | 回复 | 最后发表 |
[求助]跪求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 |