NET question: How can I reference post-build IDS camera *.dll's with no manifest in Matlab as I do in C#?

11 ビュー (過去 30 日間)
IDS camera company literature informs that several of their camera *.dll's are to be used as assembly references, and there are also 15 *.dll's that are to be copied post-build into the C# project filespace, using 4 commands like: {copy "C:\Program Files\IDS\ids_peak\generic_sdk\api\binding\dotnet\x86_64\*.dll";"$(TargetDir)"}. I have been able to successfully use the assembly references and the copied post-build *.dll files in Visual Studio to interface to camera, and the test command "peak.Library.Initialize();" works fine there now.
I can sucessfully add the two reference files in Matlab by using modified NET.addAssembly commands, as done at
asm = System.AppDomain.CurrentDomain.GetAssemblies; % copies the Assemblies of the CurrentDomain into asm
if ~any(arrayfun(@(n) strncmpi(char(asm.Get(n-1).FullName), ...
'ids_peak_dotnet', length('ids_peak_dotnet')), 1:asm.Length))
A=NET.addAssembly(...
'C:\Program Files\IDS\ids_peak\generic_sdk\api\binding\dotnet\x86_64\ids_peak_dotnet.dll');
B=NET.addAssembly(...
'C:\Program Files\IDS\ids_peak\generic_sdk\ipl\binding\dotnet\x86_64\ids_peak_ipl_dotnet.dll');
end
but I do not know how to get Matlab to recognize the the 15 *.dll's which seem to include the methods, but cannot be introduced using NET.addAssembly commands. Those *.dll's do not have a manifest, so I get the followig error message when I attempt to use NET.addAssembly:
Error using dualcams (line 19)
Message: Could not load file or assembly
'file:///C:\Users\skimbel\Desktop\Camera Info Files\PostBuildDLL
files\ids_peak_ipl_dotnet_interface.dll' or one of its dependencies. The
module was expected to contain an assembly manifest.
Source: mscorlib
HelpLink:
If I do nothing with the 15 additional *.dll's, the message that I receive when I try the "peak.Library.Initialize();" command is
Message: The type initializer for 'vision_apiPINVOKE' threw an exception.
Source: ids_peak_dotnet
HelpLink:
This was very similar to the message I received in Virtual Studio before I got the post-build copy commands to work to move the 15 *.dll files into the Visual Studio project filespace:
"Unhandled exception. System.TypeInitializationException: The type initializer for 'vision_apiPINVOKE' threw an exception . . .
Unable to load DLL 'ids_peak_dotnet_interface' or one of its dependencies: The specified module could not be found."
How can I get Matlab to recognize and use these other 15 *.dll's?
Thanks, Steve K

採用された回答

Steven Kimbel
Steven Kimbel 2022 年 6 月 14 日
Feedback from IDS shown below resolved the problem. not enough files were copiee to the same directory as used by the Matlab script:
To avoid this the "vision_apiPINVOKE" exception, we recommend that you manually copy the following files to the same directory as your Matlab script.
  • c:\Program Files\IDS\ids_peak\generic_sdk\api\binding\dotnet\x86_64\
  • ids_peak_dotnet.dll
  • ids_peak_dotnet.xml
  • ids_peak_dotnet_interface.dll
  • c:\Program Files\IDS\ids_peak\generic_sdk\api\lib\x86_64\
  • FirmwareUpdate_MD_VC140_v3_2_IDS.dll
  • GCBase_MD_VC140_v3_2_IDS.dll
  • GenApi_MD_VC140_v3_2_IDS.dll
  • ids_peak.dll
  • ids_peak.lib
  • log4cpp_MD_VC140_v3_2_IDS.dll
  • Log_MD_VC140_v3_2_IDS.dll
  • MathParser_MD_VC140_v3_2_IDS.dll
  • NodeMapData_MD_VC140_v3_2_IDS.dll
  • XmlParser_MD_VC140_v3_2_IDS.dll
  • c:\Program Files\IDS\ids_peak\generic_sdk\ipl\binding\dotnet\x86_64\
  • ids_peak_ipl_dotnet.dll
  • ids_peak_ipl_dotnet.xml
  • ids_peak_ipl_dotnet_interface.dll
  • c:\Program Files\IDS\ids_peak\generic_sdk\ipl\lib\x86_64\
  • ids_peak_ipl.dll
  • ids_peak_ipl.lib
  5 件のコメント
Yonatan Wiegner
Yonatan Wiegner 2023 年 8 月 13 日
Is it a way to get a code which saves a single frame from the NET?
I have copied the relvant files to the same folder and even can get the serial number of the device but how do I get a single frame from the device?
This is the code IDS sent me:
asmInfo2 = NET.addAssembly('ids_peak_dotnet.dll');
% initialize library
peak.Library.Initialize();
peakVersion = peak.Library.Version();
% create a device manager object
deviceManager = peak.DeviceManager.Instance();
% update the deviceManager
deviceManager.Update();
selectedDevice = 0;
deviceCount = deviceManager.Devices().Count();
fprintf('deviceCount: %i\n ', deviceCount);
%x= deviceManager.Devices().Item(0).IsOpenable();
%open the selected device
device = deviceManager.Devices().Item(0).OpenDevice(peak.core.DeviceAccessType.Control);
device.SerialNumber %this works OK
dataStreams = device.DataStreams();
%dataStream=peak.core.DataStream();
% get the remote device node map
nodeMapRemoteDevice = device.RemoteDevice().NodeMaps().Item(0);
NET.invokeGenericMethod(nodeMapRemoteDevice,'FindNode',...
{'peak.core.nodes.EnumerationNode'},"UserSetSelector").SetCurrentEntry("Default");
NET.invokeGenericMethod(nodeMapRemoteDevice,'FindNode',...
{'peak.core.nodes.CommandNode'},"UserSetLoad").Execute();
NET.invokeGenericMethod(nodeMapRemoteDevice,'FindNode',...
{'peak.core.nodes.CommandNode'},"UserSetLoad").WaitUntilDone();
% Get the payload size for correct buffer allocation
% ret = NET.invokeGenericMethod(nodeMapRemoteDevice,'FindNode',...
% {'peak.core.nodes.IntegerNode'},"PayloadSizea
% payload_size = ret.Value();
payload_size = NET.invokeGenericMethod(nodeMapRemoteDevice,'FindNode',...
{'peak.core.nodes.IntegerNode'},"PayloadSize").Value();
device.Dispose();
peak.Library.Close();
Louise
Louise 2025 年 4 月 5 日
Did anyone find solutions to get their IDS camera fully working and capturing frames?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by