当我尝试将PointGrey BlackFly相机作为GigE或WinVideo imaq.VideoDevice打开时,如果相机已在FlyCapture2中打开,如何防止Matlab锁定?
我的代码
if ~ exist('videoDevice','var')
videoDevice = imaq.VideoDevice('winvideo', 2, 'RGB24_1288x728');
end
如果相机已在FlyCapture2中打开,95%的时间会阻止并挂起Matlab。
系统:Windows 7企业版,64位,Matlab 2016a,FlyCapture2 2.9.3或2.10
答案 0 :(得分:1)
我不认为你可以同时激活FlyCapture2和Image Acquisition工具箱 我能给你的最好建议是在Matlab中打开设备之前检查FlyCapture2进程是否正在运行。
测试FlyCapture2是否正在运行:
[status, result] = system('tasklist /FI "imagename eq Point Grey FlyCap2.exe" /fo table /nh');
结果(运行时):
Point Grey FlyCap2.exe 46820 Console 3 43,232 K
您可以显示警告消息和/或终止FlyCap2.exe进程:
[status, result] = system('tasklist /FI "imagename eq Point Grey FlyCap2.exe" /fo table /nh');
if (~isempty(strfind(result, 'FlyCap2.exe')))
%Display warning, and wait for user to press OK.
waitfor(warndlg('FlyCap2.exe process is running'));
%Terminate FlyCap2.exe process.
system('taskkill /f /im "Point Grey FlyCap2.exe"');
end
%Open device...
if ~ exist('videoDevice','var')
videoDevice = imaq.VideoDevice('winvideo', 2, 'RGB24_1288x728');
end