Image capture using webcam

조회 수: 5 (최근 30일)
Prateek
Prateek 2011년 4월 16일
편집: Walter Roberson 2020년 5월 16일
I am using matlab for capturing image using a webcam(company-Labtec) whenever i get a snapshot the image appears Red.How should i overcome this problem?
Also how can I increase the shuter exposore time of the webcam?
OS-Windows XP
  댓글 수: 3
Mohan Kant
Mohan Kant 2017년 3월 12일
the same problem with me please solve that problem
Chaitanya Panse
Chaitanya Panse 2018년 5월 27일
편집: Chaitanya Panse 2018년 5월 27일
The problem with my GUI is that whenever i connect an external webcam and run in GUI the axis becomes very small that it is hardly seen. How do i overcome this problem? Please help.

댓글을 달려면 로그인하십시오.

채택된 답변

David Tarkowski
David Tarkowski 2011년 4월 20일
I'm going to guess that the problem is the color space that your camera returns data in is not RGB. This is common for a lot of webcams. The commands commonly used to display images such as image or imshow expect RGB data. If you pass in YCbCr (or YUV) data, the result is an image that looks vaguely correct but has a pink and green hue to it.
There are a number of ways to work around this, but in your case, I suspect that the easiest will be to change the ReturnedColorSpace property of the videoinput object:
vid = videoinput('winvideo', 1);
set(vid, 'ReturnedColorSpace', 'RGB');
img = getsnapshot(vid);
imshow(img)
  댓글 수: 9
Image Analyst
Image Analyst 2017년 8월 1일
Try this:
>> ver
>> which getsnapshot
What does it say? You probably don't have the Image Acquisition Toolbox installed.
Ritika
Ritika 2018년 2월 3일
How to save the snapshots during recording...can u Please help me for this

댓글을 달려면 로그인하십시오.

추가 답변 (5개)

Mark Jones
Mark Jones 2011년 4월 25일
편집: John Kelly 2013년 11월 13일
Alternatively, it may be that your camera needs to warm up. To allow for this, try using manual triggering and GETSNAPSHOT.

Ian
Ian 2014년 7월 7일
I got this to work, but is there a way to then read that image? Like to call it back so matlab can analyze it?
  댓글 수: 6
Ian
Ian 2014년 7월 10일
Ahhh thank you very much! I have gotten the code to work now.
Antonio Meza
Antonio Meza 2015년 11월 5일
Thank you!! it works. Finally, i can finish my project. Greetengs from Mexico

댓글을 달려면 로그인하십시오.


finalyear project
finalyear project 2016년 10월 21일
Tried to take an image using webcam by following code
vid = videoinput('winvideo', 3);
set(vid, 'ReturnedColorSpace', 'RGB');
img = getsnapshot(vid);
imshow(img)
but still got black image.Can anybody please suggest something?
  댓글 수: 1
Syed Aameer
Syed Aameer 2017년 2월 1일
attach this code above to to your code axes(handles.axes1);
hImage=image(zeros(80,120,3),'Parent',handles.axes1); preview(vid,hImage);

댓글을 달려면 로그인하십시오.


mohamed hushan
mohamed hushan 2017년 10월 5일
편집: Walter Roberson 2020년 5월 16일
vid = videoinput('winvideo', 1);
set(vid, 'ReturnedColorSpace', 'RGB');
img = getsnapshot(vid); imshow(img)
after that how to save the snap images into folder?

Shrey Garg
Shrey Garg 2020년 5월 16일
webcam not working in matlab
it opensup logitech webcam nut it doesnot works and displays message that application already opened

Community Treasure Hunt

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

Start Hunting!

Translated by