how to make a live video from webcam to appear on the fig file which i have created
You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Show older comments
0 votes
how to make a live video from webcam to appear on the fig file which i have created
Accepted Answer
Stephen
on 4 May 2012
You may try these.
clear all;
imaqmem(80000000) ;
aviobj = avifile('myavifile6');
aviobj.quality = 100;
vid = videoinput('winvideo',1,'YUY2_640x480');
set(vid,'returnedcolorspace','rgb');
set(vid,'framespertrigger',inf);
set(vid,'timerperiod',1);
set(vid,'timeout',500);
set(vid, 'DiskLogger',aviobj);
set(vid,'loggingmode','disk');
vidRes = get(vid, 'VideoResolution');
nBands = get(vid, 'NumberOfBands');
subplot(1,2,1);hImage = imshow( zeros(vidRes(2), vidRes(1), nBands),'InitialMagnification',100' );
preview(vid,hImage);
start(vid)
while(1)
frame = getsnapshot(vid);
subplot(1,2,2);imshow(frame,'InitialMagnification',100');
Ha_ax=gca;
str = get(gcf,'currentkey');
if strcmp(str,'space')
break;
else
continue;
end
end
stop(vid);
aviobj =close(aviobj );
7 Comments
mahendra kumar
on 4 May 2012
Sir, how to increase resolution of the video screen
Walter Roberson
on 5 May 2012
Change the 'YUY2_640x480' to a higher number supported by your camera.
mahendra kumar
on 5 May 2012
sir, how to capture the frames after every 15 sec;
Walter Roberson
on 5 May 2012
Put
pause(15)
on the line before getsnapshot()
However, you will need to test this, as it might be the case that the preview pauses as well. If so then you would need a different method.
mahendra kumar
on 6 May 2012
thank u so much sir, ur code worked perfectly for my project:-):-):-)
mahendra kumar
on 6 May 2012
sir, do u know how to draw a bound box on the live video which is been capturing, as i m doing a face detection project, so i need to detect the face in the video and draw a bound box around it..i hav the code to detect the face from the frame, which i capture from the video,but i want to do the face detection on the live video itself.can u plz help me
Stephen
on 6 May 2012
seems that you can get some hints from the moving-detection code,which is easy to be found on the internet
More Answers (0)
Categories
Find more on Video Formats and Interfaces in Help Center and File Exchange
Tags
See Also
on 4 May 2012
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)