shimat / opencvsharp

OpenCV wrapper for .NET
Apache License 2.0
5.22k stars 1.13k forks source link

Unable to find an entry point named aruco_Dictionary_delete #1565

Open jerkohren opened 1 year ago

jerkohren commented 1 year ago

Summary of your issue

Hi, i am getting this exception when trying to find ArUco markers. On Windows machine it works without problems. The problem is Raspberry Pi OS.

Environment

PRETTY_NAME="Raspbian GNU/Linux 10 (buster)" NAME="Raspbian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=raspbian ID_LIKE=debian

What did you do when you faced the problem?

I tried to add different nuget packages of OpenCvSharp but nithing helps.

Example code:

Here is my methof, exception is thrown on line 19.

   11     public static bool FindArUcoMarker(Mat frame)
   12    {
   13         using var dict = CvAruco.GetPredefinedDictionary(PredefinedDictionaryName.Dict6X6_250);
   14
   15        var param = new DetectorParameters();
   16        CvAruco.DetectMarkers(frame, dict, out var corners, out var ids, param, out var rejectedImgPoints);
   17
   18         Debugging.Debug.DrawArucoMarker(ref frame, corners, ids, new Scalar(255, 0, 0));
   19         return true;
   20   }

Output:

System.EntryPointNotFoundException: Unable to find an entry point named 'aruco_Dictionary_delete' in shared library 'OpenCvSharpExtern'.
   at OpenCvSharp.Internal.NativeMethods.aruco_Dictionary_delete(IntPtr ptr)
   at OpenCvSharp.Aruco.Dictionary.DisposeUnmanaged()
[16:15:17 ERR] Stack Trace:  ---     at OpenCvSharp.Internal.NativeMethods.aruco_Dictionary_delete(IntPtr ptr)
   at OpenCvSharp.Aruco.Dictionary.DisposeUnmanaged()
[16:15:17 ERR] Unable to find an entry point named 'aruco_Dictionary_delete' in shared library 'OpenCvSharpExtern'.
[16:15:17 ERR] *** Global * Exception * Handling ***
[16:15:17 ERR] System.EntryPointNotFoundException: Unable to find an entry point named 'aruco_Dictionary_delete' in shared library 'OpenCvSharpExtern'.
   at OpenCvSharp.Internal.NativeMethods.aruco_Dictionary_delete(IntPtr ptr)
   at OpenCvSharp.Aruco.Dictionary.DisposeUnmanaged()
   at OpenCvSharp.DisposableObject.Dispose(Boolean disposing)
   at OpenCvSharp.DisposableObject.Dispose()
   at ....ArUcoMarkerDetector.FindArUcoMarker(Mat frame) in C:\...\ArUcoMarkerDetector.cs:line 19
   at ...Worker.Start() in C:\....CvWorker.cs:line 294

What did you intend to be?

I have installed this nuget packages:

<PackageReference Include="OpenCvSharp4" Version="4.7.0.20230115" />
<PackageReference Include="OpenCvSharp4.Extensions" Version="4.7.0.20230115" />
<PackageReference Include="OpenCvSharp4.runtime.linux-arm" Version="4.7.0.20230115" />
<PackageReference Include="OpenCvSharp4.WpfExtensions" Version="4.7.0.20230115" />
jerkohren commented 1 year ago

I have found a cause. It is in line: using var dict = CvAruco.GetPredefinedDictionary(PredefinedDictionaryName.Dict6X6_250); After i removed using keyword, it worked. Can someone explain this please? Here is DrawArucoMarker method: public static void DrawArucoMarker(ref Mat frame, Point2f[][] corners, int[] ids, Scalar size) { var arUcoFrame = frame.Clone(); CvAruco.DrawDetectedMarkers(arUcoFrame, corners, ids, size); Cv2.ImShow("ArUco detector", arUcoFrame); }

stale[bot] commented 6 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.