getsnapshot does not give clear image

3 ビュー (過去 30 日間)
garima
garima 2012 年 3 月 3 日
コメント済み: ali 2014 年 12 月 1 日
I wrote a code for image acquisition,when i get a live video using ' videoinput' function i get clear live video. but when i use getsnapshot function to get captured image from live video, i dont get clear image. plz give me solution of this. thank you.
imaqhwinfo
info = imaqhwinfo('coreco')
info.DeviceInfo
%dev_info = imaqhwinfo('demo',info.DeviceInfo.DeviceID);
vid=videoinput('winvideo',1,'YUY2_640x480');
preview(vid)
frame = getsnapshot(vid);
image(frame);
delete(vid);
  1 件のコメント
ali
ali 2014 年 12 月 1 日
1.use "pause(4)" before getsnapshot 2 use "set(vid,'ReturnedColorSpace', 'RGB');"

サインインしてコメントする。

採用された回答

vish
vish 2012 年 3 月 3 日
Your image snapshot is in YUY2 format. What you need to do is convert your YUY2 image to RGB. You can find one on file exchange section.
  2 件のコメント
Image Analyst
Image Analyst 2012 年 3 月 3 日
If that's the problem there should be a rgb mode that shows up in the winvideo category of the hardware browser when he runs imaqtool. He should pick one of the RGB modes.
vish
vish 2012 年 3 月 3 日
In some of the cameras, the RGB mode doesnt appear.

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2012 年 3 月 3 日
Define "clear". It should look fairly similar but maybe noisier. A single snapshot will always appear noisier than a video stream. Also be aware that some cameras have two different sets of settings, one for video mode and one for snapshot mode. You could be adjusting the camera to look good under video but then when you switch to snapshot mode, it's using a different set of settings. This could be what's happening if it's more than simply a noisier image. Consult Coreco for how their cameras work. Also, you might want to use the Coreco driver built for their camera, if they have one, rather than the generic winvideo driver.

Community Treasure Hunt

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

Start Hunting!

Translated by