Code covered by the BSD License  

Highlights from
Video Recording

image thumbnail

Video Recording



Recording video & snapshots using a web cam or other.

function varargout = Creat_AVI(varargin)
% CREAT_AVI M-file for Creat_AVI.fig
% Last Modified by GUIDE v2.5 25-Nov-2011 13:21:27
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @Creat_AVI_OpeningFcn, ...
                   'gui_OutputFcn',  @Creat_AVI_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
    gui_mainfcn(gui_State, varargin{:});
% End initialization code - DO NOT EDIT
% --- Executes just before Creat_AVI is made visible.
function Creat_AVI_OpeningFcn(hObject, eventdata, handles, varargin)
handles.filename = varargin{1};
handles.fps = varargin{2};
handles.codec = 'none';
handles.filename2save = [fileparts(handles.filename) filesep 'animation.avi'];

handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% --- Outputs from this function are returned to the command line.
function varargout = Creat_AVI_OutputFcn(hObject, eventdata, handles) 
varargout{1} = handles.output;
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
imglist= dir([fileparts(handles.filename) filesep 'CamRec*.jpeg']);
set(handles.text_to_be_proccessed, 'string', num2str(max(size(imglist)))),
set(handles.text_status, 'string', 'Proccesing frames...'),
for k= 1:length(imglist);
	img= imread([fileparts(handles.filename) filesep imglist(k).name]);			% get current frame
	m(k)= im2frame(img, gray(256));
    set(handles.text_proccessed, 'string', num2str(k)),
set(handles.text_status, 'string', 'Creating File, wait...'),pause(0.5)
% create avi:
movie2avi(m, handles.filename2save, 'compression', handles.codec, 'fps', handles.fps);
% play result:
%movie(m, 1, handles.fps),
set(handles.text_status, 'string', 'File is ready.'),

Contact us