Undefined function 'snapshot' for input arguments of type 'double' why this error?
古いコメントを表示
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);
1 件のコメント
mack cartagena
2018 年 6 月 1 日
回答 (2 件)
Steven Lord
2018 年 6 月 1 日
1 投票
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 件のコメント
Steven Lord
2018 年 6 月 1 日
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
2020 年 1 月 13 日
0 投票
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.
カテゴリ
ヘルプ センター および File Exchange で GigE Vision Hardware についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!