regarding use of camera of laptop when asked?

1 次查看(过去 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 CenterFile Exchange 中查找有关 MATLAB 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