Saturday, 29 June 2013

Embed camera in Matlab and take clear snapshots.

Most of Matlab users have problem in taking snapshots,most of time Matlab does not capture clear snapshots but this program is easy to understand and takes clear snapshots. 




%close all

%imaqhwinfo
%dev_info=imaqhwinfo('winvideo',1)
%info=imaqhwinfo('winvideo')
% celldisp(dev_info.SupportedFormats)
vid=videoinput('winvideo',1,'YUY2_320x240');
%Open Figure
hFigure=figure(1);
%set parameters for video
%Acquire only one frame each time
triggerconfig(vid,'Manual');
set(vid,'framespertrigger',1);
%Go on forever untill stopped
set(vid,'triggerrepeat',Inf);
%Get a grayscale image
set(vid,'ReturnedColorSpace','RGB');
start(vid);
preview(vid);

0 comments:

Post a Comment