You are on page 1of 3

Search: MATLAB Central

Discover what MATLAB

can
do for your career.
Opportunities for recent
engineering grads.
Apply Today
Create Account Log In
File Exchange Answers Newsgroup Link Exchange Blogs Trendy Cody Contest MathWorks.com
Subject: Interfacing Camera to Matlab
From: Kushagra Garg
Date: 25 Aug, 2008 04:50:16
Message: 1 of 4
Reply to this message
Add author to My Watch List
View original format
Flag as spam
Subject: Interfacing Camera to Matlab
From: Dave Tarkowski
Date: 25 Aug, 2008 13:33:24
Message: 2 of 4
Reply to this message
Add author to My Watch List
View original format
Flag as spam
Thread Subject:
Interfacing Camera to Matlab
I tried to interface Gemini usb 2.0 webcam to matlab using following commands--
cam=videoinput('winvideo')
It gives the following output.
Summary of Video Input Object Using 'USB2.0 Web Camera'.
Acquisition Source(s): input1 is available.
Acquisition Parameters: 'input1' is the current selected source.
10 frames per trigger using the selected source.
'RGB24_640x480' video data to be logged upon START.
Grabbing first of every 1 frame(s).
Log data to 'memory' on trigger.
Trigger Parameters: 1 'immediate' trigger(s) on START.
Status: Waiting for START.
0 frames acquired since starting.
0 frames available for GETDATA.
start(cam);
preview(cam);
Till this point it works fine.
frame=getsnapshot(cam);
imshow(frame);
The image shown is completely black.The array frame has all RGB values 0.
Kushagra Garg wrote:
> I tried to interface Gemini usb 2.0 webcam to matlab using following commands--
>
> cam=videoinput('winvideo')
> It gives the following output.
>
> Summary of Video Input Object Using 'USB2.0 Web Camera'.
>
> Acquisition Source(s): input1 is available.
>
> Acquisition Parameters: 'input1' is the current selected source.
> 10 frames per trigger using the selected source.
> 'RGB24_640x480' video data to be logged upon START.
> Grabbing first of every 1 frame(s).
> Log data to 'memory' on trigger.
Tags for this Thread
No tags are associated with this
thread.
What are tags?
A tag is like a keyword or category
label associated with each thread.
Tags make it easier for you to find
threads of interest.
Anyone can tag a thread. Tags are
public and visible to everyone.
Add thread to My Watch List
What is a Watch List?
MATLAB Central > MATLAB Newsreader > Interfacing Camera to Matlab
Page 1 of 3 Interfacing Camera to Matlab - Newsreader - MATLAB Central
22-09-2014 http://www.mathworks.com/matlabcentral/newsreader/view_thread/235074
Subject: Interfacing Camera to Matlab
From: Kushagra Garg
Date: 25 Aug, 2008 16:47:19
Message: 3 of 4
Reply to this message
Add author to My Watch List
View original format
Flag as spam
Subject: Interfacing Camera to Matlab
From: Dave Tarkowski
Date: 25 Aug, 2008 19:31:01
Message: 4 of 4
Reply to this message
Add author to My Watch List
View original format
Flag as spam
>
> Trigger Parameters: 1 'immediate' trigger(s) on START.
>
> Status: Waiting for START.
> 0 frames acquired since starting.
> 0 frames available for GETDATA.
>
>
>
> start(cam);
> preview(cam);
> Till this point it works fine.
>
> frame=getsnapshot(cam);
> imshow(frame);
>
> The image shown is completely black.The array frame has all RGB values 0.
Is the preview window open when you call getsnapshot?
Some cameras, notably web cams, start out with black frames. It takes
the automatic gain control a couple frames to adjust and give you a
proper image. This is most likely happening when you start the video
preview, but since it only last a few frames, you don't really notice it.
If the preview window is closed when you call getsnapshot, the camera is
not acquiring data therefore the automatic gain control isn't working.
Since it takes a few frames to get good images back, you'll always get
black images that way. However, there a few workarounds. One, you can
leave the preview window open while calling getsnapshot. This leaves
the camera active, and you should get valid images back.
If you don't want to have the preview window open, you can use the
manual triggering mode of the toolbox. Try this:
>> triggerconfig(cam, 'manual');
>> start(cam);
>> pause(.5); % Wait for the camera to adjust the AGC
>> frame = getsnapshot(cam);
>> stop(cam);
You can see
http://www.mathworks.com/products/imaq/demos.html?
file=/products/demos/shipping/imaq/demoimaq_Getsnapshot.html
for more information on using manual triggering and getsnapshot.
-Dave
It works by keeping the preview window open!!!!!
Thanks a lot!!!
I have one more query--
When I try to take continuous images,after taking 6 to 7 images,the cam gives a timeout.
Actually,I want to get a frame rate of 10-12 frames per second but it's giving timeout.
Any solution?
Kushagra Garg wrote:
> It works by keeping the preview window open!!!!!
> Thanks a lot!!!
>
> I have one more query--
> When I try to take continuous images,after taking 6 to 7 images,the cam gives a timeout.
> Actually,I want to get a frame rate of 10-12 frames per second but it's giving timeout.
Page 2 of 3 Interfacing Camera to Matlab - Newsreader - MATLAB Central
22-09-2014 http://www.mathworks.com/matlabcentral/newsreader/view_thread/235074
Site Help Patents Trademarks Privacy Policy Preventing Piracy Terms of Use
Featured MathWorks.com Topics: New Products Support Documentation Training Webinars Newsletters MATLAB Trials Careers
> Any solution?
I'm not sure that I understand your problem. Can you post some code
that reproduces the issue and the exact error message that you are
receiving?
-Dave
Feed for this Thread
Contact us
1994-2014 The MathWorks, Inc.
Page 3 of 3 Interfacing Camera to Matlab - Newsreader - MATLAB Central
22-09-2014 http://www.mathworks.com/matlabcentral/newsreader/view_thread/235074

You might also like