我的程序可以在Windows 8 x64中正常工作。但是,当我尝试在装有Windows 7 x64的笔记本电脑上运行它时,我遇到了一些问题。
错误:
A first chance exception of type 'System.ArgumentException' occurred in mscorlib.dll
Additional information: URI formats are not supported.
A first chance exception of type 'System.BadImageFormatException' occurred in Emgu.CV.dll
Additional information: You tried to load the wrong format. (Excluded from the HRESULT: 0x8007000B)
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
Additional information: Target call threw an exception.
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
Additional information: Target call threw an exception.
'InzV2.vshost.exe' (CLR v4.0.30319: InzV2.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xaml.resources\v4.0_4.0.0.0_pl_b77a5c561934e089\System.Xaml.resources.dll'. Module was built without symbols.
A first chance exception of type 'System.Xaml.XamlObjectWriterException' occurred in System.Xaml.dll
Additional information:Calling the constructor for the type of „InzV2.MainWindow” compatible with specific binding constraints caused an exception.
A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll
Additional information: Calling the constructor for the type of „InzV2.MainWindow” compatible with specific binding constraints caused an exception., line number 3, position 9.
An unhandled exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll
Additional information: Calling the constructor for the type of „InzV2.MainWindow” compatible with specific binding constraints caused an exception., line number 3, position 9.
BackgroundSubtractorMOG2 pMog11 = new BackgroundSubtractorMOG2(0, 80, false);
最佳答案
当非托管程序集是为不同于当前正在编译的.NET代码的平台编译的时,会发生此错误。
例如,如果非托管dll在x86体系结构中,而您尝试将代码编译为x64 .NET运行时,则将出现此类错误。
在您提供的镜像中,您似乎正在尝试将代码编译为x86体系结构,而您的EmguCV非托管.dll可能基于x64。
所以去
项目->属性->生成->选中与非托管dll编译平台相匹配的平台(x86,x64)(在您的情况下,可能为x64)。
https://stackoverflow.com/questions/23725209/