opencvsharp icon indicating copy to clipboard operation
opencvsharp copied to clipboard

System.TypeInitializationException: The type initializer for 'OpenCvSharp.Internal.NativeMethods'

Open Robinbr21 opened this issue 1 year ago • 1 comments

Summary of your issue

---> System.DllNotFoundException: Unable to load shared library 'OpenCvSharpExtern' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libOpenCvSharpExtern: cannot open shared object file: No such file or directory at OpenCvSharp.Internal.NativeMethods.redirectError(CvErrorCallback errCallback, IntPtr userdata, IntPtr& prevUserdata) at OpenCvSharp.Internal.ExceptionHandler.RegisterExceptionCallback() at OpenCvSharp.Internal.NativeMethods.LoadLibraries(IEnumerable`1 additionalPaths) at OpenCvSharp.Internal.NativeMethods..cctor()

Environment

Ubuntu 18.04.6 LTS i also encounterd the same issue on Mac OS ,, but there is no issue in Windows system

Example code:

           string imagePath = Environment.GetEnvironmentVariable("HOME") +"/Pictures/Screenshot.png";
            Mat image = Cv2.ImRead(imagePath, ImreadModes.Unchanged);
            DetectSensitiveAreas(image);

the error hits on second line

Robinbr21 avatar Apr 29 '23 10:04 Robinbr21

Having the same issue on an up2date M1 Air. Really annoying since I am trying to port some apps to Avalonia to be multiplatform, and now its an OpenCV issue being a show-stopper...

ax-meyer avatar Jul 08 '23 11:07 ax-meyer