using OpenCvSharp.Features2D;
namespace SiftTest
{
internal class Program
{
public static void Main(string[] args)
{
var sift = SIFT.Create();
}
}
}
Output:
Unhandled Exception:
System.TypeInitializationException: The type initializer for 'OpenCvSharp.Internal.NativeMethods' threw an exception. ---> OpenCvSharp.OpenCvSharpException: OpenCvSharpExtern assembly:<unknown assembly> type:<unknown type> member:(null) ---> System.DllNotFoundException: OpenCvSharpExtern assembly:<unknown assembly> type:<unknown type> member:(null)
at (wrapper managed-to-native) OpenCvSharp.Internal.NativeMethods.core_Mat_sizeof()
at OpenCvSharp.Internal.NativeMethods.TryPInvoke () [0x0000e] in <4e2175a3b7ad402e9ad71963e26dd6c4>:0
--- End of inner exception stack trace ---
at OpenCvSharp.Internal.NativeMethods.TryPInvoke () [0x0003b] in <4e2175a3b7ad402e9ad71963e26dd6c4>:0
at OpenCvSharp.Internal.NativeMethods..cctor () [0x0003f] in <4e2175a3b7ad402e9ad71963e26dd6c4>:0
--- End of inner exception stack trace ---
at OpenCvSharp.Features2D.SIFT.Create (System.Int32 nFeatures, System.Int32 nOctaveLayers, System.Double contrastThreshold, System.Double edgeThreshold, System.Double sigma) [0x00000] in <4e2175a3b7ad402e9ad71963e26dd6c4>:0
at SiftTest.Program.Main (System.String[] args) [0x00001] in <99a6f6fe67264acdb6c481b91860c2a5>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'OpenCvSharp.Internal.NativeMethods' threw an exception. ---> OpenCvSharp.OpenCvSharpException: OpenCvSharpExtern assembly:<unknown assembly> type:<unknown type> member:(null) ---> System.DllNotFoundException: OpenCvSharpExtern assembly:<unknown assembly> type:<unknown type> member:(null)
at (wrapper managed-to-native) OpenCvSharp.Internal.NativeMethods.core_Mat_sizeof()
at OpenCvSharp.Internal.NativeMethods.TryPInvoke () [0x0000e] in <4e2175a3b7ad402e9ad71963e26dd6c4>:0
--- End of inner exception stack trace ---
at OpenCvSharp.Internal.NativeMethods.TryPInvoke () [0x0003b] in <4e2175a3b7ad402e9ad71963e26dd6c4>:0
at OpenCvSharp.Internal.NativeMethods..cctor () [0x0003f] in <4e2175a3b7ad402e9ad71963e26dd6c4>:0
--- End of inner exception stack trace ---
at OpenCvSharp.Features2D.SIFT.Create (System.Int32 nFeatures, System.Int32 nOctaveLayers, System.Double contrastThreshold, System.Double edgeThreshold, System.Double sigma) [0x00000] in <4e2175a3b7ad402e9ad71963e26dd6c4>:0
at SiftTest.Program.Main (System.String[] args) [0x00001] in <99a6f6fe67264acdb6c481b91860c2a5>:0
Process finished with exit code 1.
Summary of your issue
I am unable to make libOpenCvSharpExtern.dylib to be incuded in my debug build.
I can see it exists in the packages folder, but somehow not included in the build
Environment
Apple M2 Max macOS Ventura 13.5 JetBrains Rider
Installed packages: OpenCvSharp4/4.7.0.20230115 opencvsharp4.runtime.osx.10.15-universal/4.7.0.20230224
What did you do when you faced the problem?
I have tried to force it to be included in my build by editing .csproj manually as below:
Example code:
Output:
What did you intend to be?
Run successfully.