NativeMethods_aruco.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. using System.Diagnostics.Contracts;
  2. using System.Runtime.InteropServices;
  3. using OpenCvSharp.Aruco;
  4. #pragma warning disable 1591
  5. #pragma warning disable CA1401 // P/Invokes should not be visible
  6. #pragma warning disable IDE1006 // Naming style
  7. namespace OpenCvSharp.Internal;
  8. static partial class NativeMethods
  9. {
  10. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  11. public static extern ExceptionStatus aruco_detectMarkers(
  12. IntPtr image, IntPtr dictionary, IntPtr corners, IntPtr ids, ref DetectorParameters detectParameters, IntPtr outrejectedImgPoints);
  13. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  14. public static extern ExceptionStatus aruco_drawDetectedMarkers(
  15. IntPtr image,
  16. [MarshalAs(UnmanagedType.LPArray)] IntPtr[] corners, int cornerSize1, int[] contoursSize2,
  17. [MarshalAs(UnmanagedType.LPArray)] int[] ids, int idxLength, Scalar borderColor);
  18. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  19. public static extern ExceptionStatus aruco_drawDetectedMarkers(
  20. IntPtr image, [MarshalAs(UnmanagedType.LPArray)] IntPtr[] corners, int cornerSize1, int[] contoursSize2, IntPtr ids, int idxLength, Scalar borderColor);
  21. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  22. public static extern ExceptionStatus aruco_estimatePoseSingleMarkers(
  23. [MarshalAs(UnmanagedType.LPArray)] IntPtr[] corners, int cornersLength1,
  24. int[] cornersLengths2, float markerLength,
  25. IntPtr cameraMatrix, IntPtr distCoeffs, IntPtr rvecs, IntPtr tvecs, IntPtr objPoints);
  26. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  27. public static extern ExceptionStatus aruco_getPredefinedDictionary(int name, out IntPtr returnValue);
  28. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  29. public static extern ExceptionStatus aruco_readDictionary(string dictionaryFile, out IntPtr returnValue);
  30. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  31. public static extern ExceptionStatus aruco_detectCharucoDiamond(
  32. IntPtr image, [MarshalAs(UnmanagedType.LPArray)] IntPtr[] markerCorners, int markerCornersSize1, int[] markerCornersSize2,
  33. IntPtr markerIds, float squareMarkerLengthRate,
  34. IntPtr diamondCorners, IntPtr diamondIds, IntPtr cameraMatrix, IntPtr distCoeffs);
  35. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  36. public static extern ExceptionStatus aruco_drawDetectedDiamonds(
  37. IntPtr image,
  38. [MarshalAs(UnmanagedType.LPArray)] IntPtr[] corners, int cornerSize1, int[] contoursSize2,
  39. IntPtr ids, Scalar borderColor);
  40. #region Dictionary
  41. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  42. public static extern ExceptionStatus aruco_Dictionary_delete(IntPtr ptr);
  43. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  44. public static extern ExceptionStatus aruco_Dictionary_setMarkerSize(IntPtr obj, int value);
  45. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  46. public static extern ExceptionStatus aruco_Dictionary_setMaxCorrectionBits(IntPtr obj, int value);
  47. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  48. public static extern ExceptionStatus aruco_Dictionary_getBytesList(IntPtr obj, out IntPtr returnValue);
  49. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  50. public static extern ExceptionStatus aruco_Dictionary_getMarkerSize(IntPtr obj, out int returnValue);
  51. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  52. public static extern ExceptionStatus aruco_Dictionary_getMaxCorrectionBits(IntPtr obj, out int returnValue);
  53. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  54. public static extern ExceptionStatus aruco_Dictionary_identify(
  55. IntPtr obj,
  56. IntPtr onlyBits,
  57. out int idx,
  58. out int rotation,
  59. double maxCorrectionRate,
  60. out int returnValue);
  61. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  62. public static extern ExceptionStatus aruco_Dictionary_getDistanceToId(
  63. IntPtr obj,
  64. IntPtr bits,
  65. int id,
  66. int allRotations,
  67. out int returnValue);
  68. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  69. public static extern ExceptionStatus aruco_Dictionary_generateImageMarker(
  70. IntPtr obj,
  71. int id,
  72. int sidePixels,
  73. IntPtr img,
  74. int borderBits);
  75. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  76. public static extern ExceptionStatus aruco_Dictionary_getByteListFromBits(
  77. IntPtr bits,
  78. IntPtr returnValue);
  79. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  80. public static extern ExceptionStatus aruco_Dictionary_getBitsFromByteList(
  81. IntPtr byteList,
  82. int markerSize,
  83. IntPtr returnValue);
  84. #endregion
  85. }