Error while using usb web camera
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Error while using usb web camera
After a fresh installation of my demo matlab, I want to enable usb web camera on my PC. I have tried to run program from example script:
%%Acquiring a Single Image in a Loop
% This example shows how to use the |snapshot| function to acquire live
% images from USB Webcams.
%
% MATLAB(R) Support Package for USB Webcams provides ability to bring live
% images from any USB Video Class (UVC) compliant Webcam into MATLAB(R).
% Copyright 2014 The MathWorks, Inc.
%%Identifying Available Webcams
% The |webcamlist| function provides a cell array of webcams on the current
% system that MATLAB(R) can access.
camList = webcamlist
%%Set up Connection to Webcam
% A Webcam object represents the connection between MATLAB(R) and the USB
% webcam. To create a connection to the webcam, use the |webcam| function
% and indicate what camera to be connected with. You can specify the camera
% either by name or index as returned by |webcamlist|. This example uses
% the "Logitech HD Webcam C310" camera. Once the connection is established,
% you can access specific property values by using the dot(.) notation.
% Connect to the webcam.
cam = webcam(1)
%%Preview Video Stream
% To open a Video Preview window, use the |preview| function. The Video
% Preview window displays the live video stream from the device.
preview(cam);
%%Acquire a Frame
% To acquire a single frame, use the |snapshot| function.
img = snapshot(cam);
% Display the frame in a figure window.
image(img);
%%Acquiring Multiple Frames
% A common task is to repeatedly acquire a single image, process it, and
% then store the result. To do this, |snapshot| should be called in a loop.
for idx = 1:5
img = snapshot(cam);
image(img);
end
%%Clean up
% Once the connection is no longer needed, clear the associated variable.
clear cam
But I get error msg on the screen:
Trial>> webcam_gettingstarted
camList =
cell
'Microsoft® LifeCam Studio(TM)'
cam =
webcam (具有属性):
Name: 'Microsoft® LifeCam Studio(TM)'
Resolution: '640x480'
AvailableResolutions: {1×12 cell}
BacklightCompensation: 0
WhiteBalance: 4500
Contrast: 5
Sharpness: 25
Pan: 0
Exposure: -6
ExposureMode: 'auto'
Zoom: 0
Brightness: 143
FocusMode: 'auto'
Tilt: 0
Focus: 10
WhiteBalanceMode: 'auto'
Saturation: 99
Error locking media buffer.
出错 matlab.webcam.internal.PreviewController/localSqueezeDefaultFig
出错 matlab.webcam.internal.PreviewController/createDefaultWindow
出错 matlab.webcam.internal.PreviewController/preview
出错 webcam/preview (line 267)
imHandle = obj.CamPreviewController.preview(varargin);
出错 webcam_gettingstarted (line 29)
preview(cam);
Error. The webcam returned an unsupported FrameType.
出错 matlab.webcam.internal.PreviewController/localSqueezeDefaultFig
出错 matlab.webcam.internal.PreviewController/createDefaultWindow
出错 matlab.webcam.internal.PreviewController/preview
出错 webcam/preview (line 267)
imHandle = obj.CamPreviewController.preview(varargin);
出错 webcam_gettingstarted (line 29)
preview(cam);
错误使用 matlab.webcam.internal.WebcamController/getCurrentFrame
尝试从网络摄像机获取帧时发生超时。
出错 webcam/snapshot (line 227)
[image, timestamp] = obj.CamController.getCurrentFrame();
出错 webcam_gettingstarted (line 43)
img = snapshot(cam);
Trial>>
And two output pictures:


I have no idea what is happen. Is there a kindly man who can help me? Thanks very much!
I can get the right image from windows camera application, so I am sure no issues with my web camera.

My environment:
Trial>> ver
-----------------------------------------------------------------------------------------------
MATLAB 版本: 9.1.0.441655 (R2016b)
MATLAB 许可证编号: DEMO
操作系统: Microsoft Windows 10 企业版 Version 10.0 (Build 10586)
Java 版本: Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------
MATLAB 版本 9.1 (R2016b)
Computer Vision System Toolbox 版本 7.2 (R2016b)
Image Acquisition Toolbox 版本 5.1 (R2016b)
Image Processing Toolbox 版本 9.5 (R2016b)
Parallel Computing Toolbox 版本 6.9 (R2016b)
Signal Processing Toolbox 版本 7.3 (R2016b)
Statistics and Machine Learning Toolbox 版本 11.0 (R2016b)
Trial>>
2 Kommentare
Robert Koch
am 27 Sep. 2016
I have run into the same issue. I am connecting to a Microsoft Life-Cam HD-3000 and seconds after I am connected, it gives me the same error as you are receiving:
Error locking media buffer.
Error. The webcam returned an unsupported FrameType.
It happens at varying times after I connect to the webcam. Sometimes this error shows up 2 seconds after it connects and other times it appears a few minutes after it connects.
This error did not occur when using this webcam in December 2015 for me. I tried the same commands last year and it worked fine. Another thing to note is as soon as I updated my academic license of Matlab to this year (my old license expired in June), this error began to appear. I do not have a different version of matlab.
Hope this gets resolved soon!
Robert
Antworten (0)
Siehe auch
Kategorien
Mehr zu Acquisition Using Image Acquisition Explorer finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!