EstimateParameters.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. using OpenCVForUnity.CoreModule;
  2. using OpenCVForUnity.UtilsModule;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Runtime.InteropServices;
  6. namespace OpenCVForUnity.ArucoModule
  7. {
  8. // C++: class EstimateParameters
  9. /**
  10. * Pose estimation parameters
  11. *
  12. * pattern Defines center this system and axes direction (default PatternPositionType::ARUCO_CCW_CENTER).
  13. * useExtrinsicGuess Parameter used for SOLVEPNP_ITERATIVE. If true (1), the function uses the provided
  14. * rvec and tvec values as initial approximations of the rotation and translation vectors, respectively, and further
  15. * optimizes them (default false).
  16. * solvePnPMethod Method for solving a PnP problem: see REF: calib3d_solvePnP_flags (default SOLVEPNP_ITERATIVE).
  17. * SEE: PatternPositionType, solvePnP(), check tutorial_aruco_detection in aruco contrib
  18. */
  19. public class EstimateParameters : DisposableOpenCVObject
  20. {
  21. protected override void Dispose(bool disposing)
  22. {
  23. try
  24. {
  25. if (disposing)
  26. {
  27. }
  28. if (IsEnabledDispose)
  29. {
  30. if (nativeObj != IntPtr.Zero)
  31. aruco_EstimateParameters_delete(nativeObj);
  32. nativeObj = IntPtr.Zero;
  33. }
  34. }
  35. finally
  36. {
  37. base.Dispose(disposing);
  38. }
  39. }
  40. protected internal EstimateParameters(IntPtr addr) : base(addr) { }
  41. public IntPtr getNativeObjAddr() { return nativeObj; }
  42. // internal usage only
  43. public static EstimateParameters __fromPtr__(IntPtr addr) { return new EstimateParameters(addr); }
  44. //
  45. // C++: cv::aruco::EstimateParameters::EstimateParameters()
  46. //
  47. public EstimateParameters()
  48. {
  49. nativeObj = DisposableObject.ThrowIfNullIntPtr(aruco_EstimateParameters_EstimateParameters_10());
  50. }
  51. //
  52. // C++: PatternPositionType EstimateParameters::pattern
  53. //
  54. // Return type 'PatternPositionType' is not supported, skipping the function
  55. //
  56. // C++: void EstimateParameters::pattern
  57. //
  58. // Unknown type 'PatternPositionType' (I), skipping the function
  59. //
  60. // C++: bool EstimateParameters::useExtrinsicGuess
  61. //
  62. public bool get_useExtrinsicGuess()
  63. {
  64. ThrowIfDisposed();
  65. return aruco_EstimateParameters_get_1useExtrinsicGuess_10(nativeObj);
  66. }
  67. //
  68. // C++: void EstimateParameters::useExtrinsicGuess
  69. //
  70. public void set_useExtrinsicGuess(bool useExtrinsicGuess)
  71. {
  72. ThrowIfDisposed();
  73. aruco_EstimateParameters_set_1useExtrinsicGuess_10(nativeObj, useExtrinsicGuess);
  74. }
  75. //
  76. // C++: int EstimateParameters::solvePnPMethod
  77. //
  78. public int get_solvePnPMethod()
  79. {
  80. ThrowIfDisposed();
  81. return aruco_EstimateParameters_get_1solvePnPMethod_10(nativeObj);
  82. }
  83. //
  84. // C++: void EstimateParameters::solvePnPMethod
  85. //
  86. public void set_solvePnPMethod(int solvePnPMethod)
  87. {
  88. ThrowIfDisposed();
  89. aruco_EstimateParameters_set_1solvePnPMethod_10(nativeObj, solvePnPMethod);
  90. }
  91. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  92. const string LIBNAME = "__Internal";
  93. #else
  94. const string LIBNAME = "opencvforunity";
  95. #endif
  96. // C++: cv::aruco::EstimateParameters::EstimateParameters()
  97. [DllImport(LIBNAME)]
  98. private static extern IntPtr aruco_EstimateParameters_EstimateParameters_10();
  99. // C++: bool EstimateParameters::useExtrinsicGuess
  100. [DllImport(LIBNAME)]
  101. [return: MarshalAs(UnmanagedType.U1)]
  102. private static extern bool aruco_EstimateParameters_get_1useExtrinsicGuess_10(IntPtr nativeObj);
  103. // C++: void EstimateParameters::useExtrinsicGuess
  104. [DllImport(LIBNAME)]
  105. private static extern void aruco_EstimateParameters_set_1useExtrinsicGuess_10(IntPtr nativeObj, [MarshalAs(UnmanagedType.U1)] bool useExtrinsicGuess);
  106. // C++: int EstimateParameters::solvePnPMethod
  107. [DllImport(LIBNAME)]
  108. private static extern int aruco_EstimateParameters_get_1solvePnPMethod_10(IntPtr nativeObj);
  109. // C++: void EstimateParameters::solvePnPMethod
  110. [DllImport(LIBNAME)]
  111. private static extern void aruco_EstimateParameters_set_1solvePnPMethod_10(IntPtr nativeObj, int solvePnPMethod);
  112. // native support for java finalize()
  113. [DllImport(LIBNAME)]
  114. private static extern void aruco_EstimateParameters_delete(IntPtr nativeObj);
  115. }
  116. }