Undefined function 'snapshot' for input arguments of type 'double' why this error?
Afficher commentaires plus anciens
This error is showin today and yesterday wasn't! i'm creating a webcam object, settings its parameters and taking a snapshot but today seems not working, this error keeps showin. " Undefined function 'snapshot' for input arguments of type 'double' "
clear('vid');
vid=webcam('USB Camera');
vid.Resolution='2048x1536';
vid.WhiteBalanceMode='manual';
vid.ExposureMode='manual';
vid.Exposure=-5.7;
vid.Gain=0;
vid.Hue=0; %-40 40
vid.Gamma=72; %72-500
vid.Contrast=64;
vid.Saturation=35;
vid.Sharpness=1;
vid.Brightness=15; %-64 64
vid.WhiteBalance=6500; %2800-6500
vid.BacklightCompensation=2; %0-2
im=snapshot(vid);
Réponses (2)
Steven Lord
le 1 Juin 2018
1 vote
Immediately before calling snapshot, check the class of the variable vid. My guess is that between when it was defined as a webcam object and when you tried to use it as a webcam object it got overwritten.
1 commentaire
Steven Lord
le 1 Juin 2018
The fact that this occurs in a GUI is important information.
If you've written the GUI code yourself or if you used GUIDE to implement your GUI, see this documentation page for some recommended ways to create data in one callback and share it with other callbacks.
Note that the word "global" does not appear on that page. That's intentional. You should avoid using global variables. You should also avoid creating variables in the base workspace. Using either global variables/the global workspace or the base workspace gives anyone who has access to those two workspaces the ability to affect / control your GUI.
Deepak Metta
le 13 Jan 2020
0 votes
Hey mack,
This maybe because of the cameraObject you're giving as input in the form of 'vid' to snapshot function is empty. There maybe problem with detecting your webcam.
Try running "webcamlist" in command window and notice the USB camera name which you've connected. Copy that and assign it vid then modify its properties. If it's not showing any webcam items in that array output then it may be the issue with detecting your webcam.
Make sure your MATLAB has USB support packages installed.
Catégories
En savoir plus sur GigE Vision Hardware dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!