regarding use of camera of laptop when asked?

1 回表示 (過去 30 日間)
gaurav porwal
gaurav porwal 2012 年 8 月 30 日
button=questdlg('would you like to open the camera?','vid','yes!','no','no'); if button== yes; vid=videoinput('winvideo',1,'YUY2_640x480'); set(vid,'ReturnedColorSpace','rgb'); preview(vid) start(vid); im=getdata(vid,1); figure,imshow(im) imwrite(im,'xyz3.jpg') elseif button == no; end how i can correct this code,my camera is working with this code, i want to use dialouge box yes for camera on, and no for end

回答 (1 件)

Image Analyst
Image Analyst 2012 年 8 月 30 日
Try this:
promptMessage = sprintf('Do you want to use the camera?');
titleBarCaption = 'Use Camera?';
button = questdlg(promptMessage, titleBarCaption, 'Yes', 'No', 'Yes');
if strcmp(button, 'Yes')
% Set up the camera.
else
% Shutdown the camera or simply return.
end

カテゴリ

Help Center および File ExchangeMATLAB Support Package for IP Cameras についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by