regarding use of camera of laptop when asked?

1 visualizzazione (ultimi 30 giorni)
gaurav porwal
gaurav porwal il 30 Ago 2012
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

Risposte (1)

Image Analyst
Image Analyst il 30 Ago 2012
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

Categorie

Scopri di più su MATLAB Support Package for IP Cameras in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by