can i know how to get the image aquisition from external webcam to interface with pc using matlab 2014?

1 view (last 30 days)
vid = videoinput('winvideo', 2, 'YUY2_352x288'); %select input device
src = getselectedsource(vid);
vid.FramesPerTrigger =1;
vid.TriggerRepeat = Inf;
vid.ReturnedColorspace = 'rgb';
% src.FrameRate = '100';
start(vid)
go = true;
count = 0; % for counting number of frames
f = getdata(vid,2,'uint8');
BQ = ones(5);
sz=size(f);
Q=zeros(sz(1),sz(2),'uint8');
%start main loop for image acquisition
while go
Im = getdata(vid,2,'uint8'); %get image from camera
[out c z] = handtrack(Im,BQ,Q);
imshow(out);
%use this to draw square
rectangle('Position',[c(1)-z/2,c(2)-z/2,z,z],...
'LineWidth',2, 'EdgeColor','b');
drawnow; %update the image on screen
count = count +1;
if count == 10 % for 2000 frames
go = false;
end
end
stop(vid);

Accepted Answer

Image Analyst
Image Analyst on 16 Oct 2015
Maybe try the webcam support instead of the Image Acquisition Toolbox:

More Answers (0)

Community Treasure Hunt

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

Start Hunting!