how do you output a live annotated video from the webcam?
4 views (last 30 days)
Show older comments
hi
i have made a working facial recognition program and i am trying to make it so it can operate in real-time time. however i dont know how... im am using the image acquisition toolbox to get data from the webcam.
the problem is that every time i call the function to get a new image
image = getsnapshot(vid);
Matlab restarts the camera every time making it slow. i tried the function
start(vid);
at the start of my program but when i run the program, i don't get any output... on the command windows i can see its processing fine (and a lot quicker!)... but there is no output :S
can someone please help me!
thanks in advance :)
2 Comments
Walter Roberson
on 10 Sep 2012
Are there particular indications that getsnapshot() is restarting the camera? getsnapshot() is not fast; is it possible that it is simply taking longer than you expect but not restarting the camera?
Answers (1)
Image Analyst
on 10 Sep 2012
Try preview instead of start:
% Get the handle to the image in the axes.
hImage = findobj(handles.axesImage, 'Type', 'image');
% Turn on the live video.
preview(videoObject, hImage);
4 Comments
shivam verma
on 26 Jun 2019
you should use the function text(x,y,'your string')
before the preview function so that it can show the data on the preview-
example-
// sending a program to snap of 10 frames with data;
handles.output = hObject;
axes(handles.axes1);
vid=videoinput('winvideo');
hImage=image(zeros(120,160,3),'parent',handles.axes1);
set(vid, 'FramesPerTrigger', Inf);
set(vid, 'ReturnedColorspace', 'rgb');
for i=1:1:10
data = getsnapshot(vid);
figure(i)
imshow(data);
imwrite(data,'E:\New Folder\myg.jpeg');
text(20*pi,10,'my data')
preview(vid,hImage);
end %%hope this will help you getting your string data
See Also
Categories
Find more on Point Grey Hardware in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!