Strange behaviour with imaqregister and imaqreset

조회 수: 1 (최근 30일)
David K
David K 2020년 10월 23일
댓글: David K 2020년 10월 29일
Hello, I'm trying to debug my code which is dependent on the Image Acquisition toolbox.
Users are reporting that the code fails to find the adapter and I think my functions work in strange ways.
For example, I register the camera using:
imaqregister(PATH_TO_DLL_FILE, 'register');
but when I do imaqhwinfo, the output is
ans =
struct with fields:
InstalledAdaptors: {}
MATLABVersion: '9.9 (R2020b)'
ToolboxName: 'Image Acquisition Toolbox'
ToolboxVersion: '6.3 (R2020b)'
If I then do imaqreset and then imaqhwinfo, the output then becomes
ans =
struct with fields:
InstalledAdaptors: {'NAME OF DLL'}
MATLABVersion: '9.9 (R2020b)'
ToolboxName: 'Image Acquisition Toolbox'
ToolboxVersion: '6.3 (R2020b)'
So even though imaqreset explicitly is described as:
help imaqreset
imaqreset Disconnect and delete all image acquisition objects.
I seem to need to call it to actually get my .dll file recognised. This is exactly the same behaviour when unregistering the camera which means I need two sets of commands
% Register camera
imaqregister(PATH_TO_DLL_FILE, 'register');
imaqreset
imaqhwinfo % Show camera is registered
% Unregister camera
imaqregister(PATH_TO_DLL_FILE, 'unregister');
imaqreset
imaqhwinfo % Show camera is unregistered
This behaviour seems completely at odds with the documentation.
Furthermore, even though this code runs on my computer, when I deliver the code to users with the matlab runtime, they keep get DLL conflict errors or DLL not found errors; it basically means I have no idea what these functions are doing.
I also don't understand why I need to always specify the full path to the DLL. It means I need to have code to handle whether the app isdeployed or not.
I've also tried to handle the case where the camera is already registered ie:
info = imaqhwinfo;
for i = 1:length(info.InstalledAdaptors)
if info.InstalledAdaptors{i} == 'NAME OF DLL'
app.camneraInstalled = true;
end
end
But users still seem to get conflict issues.
Does anyone have an explanation for this strange behaviour? Or tips on how to handle registering cameras (especially if the camera might already be registered).

답변 (1개)

Image Analyst
Image Analyst 2020년 10월 23일
You might delve into my attached InitializeVideoCamera() function and adapt as needed.
  댓글 수: 3
David K
David K 2020년 10월 29일
Thank you for your response.

댓글을 달려면 로그인하십시오.

제품


릴리스

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by