getsnapshot

11 ビュー (過去 30 日間)
neenu jose
neenu jose 2011 年 12 月 2 日
コメント済み: Quratulann Ashraf 2020 年 2 月 28 日
dear matlab....could you please tell how to get rgb image using the function getsnapshot......could you please provide the code
  2 件のコメント
Robert Cumming
Robert Cumming 2011 年 12 月 2 日
what have "you" tried.
You will learn more doing it that way (and get better help here) rather than just asking for code...
Walter Roberson
Walter Roberson 2011 年 12 月 2 日
Is it part of the requirements that the image be written out to png and that that png then be read in? Or is it only required that the snapshot be taken and the contents of the snapshot be made available in a variable _as if_ it had been read from file?

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

採用された回答

Chandra Kurniawan
Chandra Kurniawan 2011 年 12 月 2 日
Hello,
This is the code. This code will captures images from your webcam.
clear; clc;
a = imaqhwinfo;
camera_name = char(a.InstalledAdaptors(end));
camera_info = imaqhwinfo(camera_name);
camera_id = camera_info.DeviceInfo.DeviceID(end);
resolution = char(camera_info.DeviceInfo.SupportedFormats(end));
vid = videoinput(camera_name, camera_id, resolution);
set(vid, 'FramesPerTrigger', Inf);
set(vid, 'ReturnedColorspace', 'rgb')
vid.FrameGrabInterval = 5;
start(vid)
i = 1;
while(vid.FramesAcquired <= 200)
data(:,:,:,i) = getsnapshot(vid);
imshow(data(:,:,:,i));
drawnow;
i = i + 1;
end
stop(vid);
flushdata(vid);
vid.TimerFcn = {'stop'};
Then the rgb images will be strored in the variable 'data'.
This program will aquire data for 200 frames.
So, if you want to access frame 1, you can type 'data(:,:,:,1)'.
Try to type 'imshow(data(:,:,:,1)' in the command window when process finished.
  6 件のコメント
neenu jose
neenu jose 2011 年 12 月 3 日
sir.....iam having one more doubt.....iam having a disparity matrix....how can i reconstruct a 3d image.......could you please help me
Quratulann Ashraf
Quratulann Ashraf 2020 年 2 月 28 日
sir i am doing video processing using getsnapshoe command in a loop. but this process is really slow...is there any other command to do so or any other way so that i dont get the lag.
looking forward for your reply
Thanks

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by