把自动驾驶感知系统的GUI程序,从台式机,转移到笔记本上,进行部署安装,以便带到车上,做实际测试。
Matlab无法识别USB相机的问题表征
没有相对应的设备(相机)There are no devices installed for the specified ADAPTORNAME
错误使用 videoinput (line 393)
winvideo: Image acquisition device is not accessible.
拒绝访问。
Make sure no other objects or applications are accessing the same device.
出错 USV_imageSensing>pushbutton_videoStart_Callback (line 423)
obj = videoinput('winvideo',1,'YUY2_640x480') %'winvideo'由函数imaqhwinfo查出
借助影像查看工具,出现这个问题:

Error 80070005: Cannot create video capture filter.
问题排查
相同的程序,在台式机上,能够自动识别USB摄像头,排除程序、镜头硬件的问题。
第一步:查看笔记本上,是否安装了相应的适配器
info=imaqhwinfo
info =
包含以下字段的 struct:
InstalledAdaptors: {'kinect' 'winvideo'}
MATLABVersion: '9.7 (R2019b)'
ToolboxName: 'Image Acquisition Toolbox'
ToolboxVersion: '6.1 (R2019b)'
已经安装了KINECT、winvideo等适配器
第二步:查询适合winvideo适配器的设备
out2 = imaqhwinfo('winvideo')
No devices were detected for the 'winvideo' adaptor. For troubleshooting device detection issues, click here.
out2 =
包含以下字段的 struct:
AdaptorDllName: 'C:ProgramDataMATLABSupportPackagesR2019btoolboximaqsupportpackagesgenericvideoadaptorwin64mwwinvideoimaq.dll'
AdaptorDllVersion: '6.1 (R2019b)'
AdaptorName: 'winvideo'
DeviceIDs: {1×0 cell}
DeviceInfo: [1×0 struct]
dev_info=info.DeviceInfo
dev_info =
包含以下字段的空的 1×0 struct 数组:
DefaultFormat
DeviceFileSupported
DeviceName
DeviceID
VideoInputConstructor
VideoDeviceConstructor
SupportedFormats
vid = videoinput('winvideo',1);
preview(vid);
frame = getsnapshot(vid);
figure;
imshow(frame);
ok, 问题的出来了: 设备硬件没问题、适配器没问题、程序本身没问题。问题很可能是设备的通信,被阻止了(防火墙、通信端口)
相关Matlab函数
1.查看已安装的图像采集适配器Adptor。
info=imaqhwinfo
目前,Matlab能识别多种镜头,依靠相应的适配器来执行
winvideo: 支持win 系统的镜头,最多
gige:接口的镜头
Kinetic: 双目镜头
macvideo:MAC笔记本的镜头
dcam: D接口的镜头
2. 切断系统中关于影像的所有联系,即中断各类摄像头的所有的调用。
imaqreset % 断开所有影像获取对象
imaqreset Disconnect and delete all image acquisition objects.
3. 获取影像对像
videoinput函数,获取影像对象。
obj = videoinput('winvideo', 1,'YUY2_320x240');
obj = videoinput(‘macvideo’,1,’YCbCr422_1280x720’)
4. 对获取的影像,进行可视化
preview(obj);
5. 获取镜头所支持的分辨率
out2.DeviceInfo.SupportedFormats
解决方法
问题一:图像分辨率大于显示器分辨率:
obj = videoinput('winvideo',3,'MJPG_3840x2160');preview(obj)
警告: The BacklightCompensation property was unable to be set to the requested value and has been adjusted. Check the current value before
continuing your work.
问题二:连通问题
查看电脑的设备管理器,是否硬件连接了摄像头;
如果硬件连接成功,但是不能访问,很可能是访问权限的限制。更改设置的方式如下。
