CharucoBoard.cs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. 
  2. using OpenCVForUnity.CoreModule;
  3. using OpenCVForUnity.UtilsModule;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Runtime.InteropServices;
  7. namespace OpenCVForUnity.ArucoModule
  8. {
  9. // C++: class CharucoBoard
  10. //javadoc: CharucoBoard
  11. public class CharucoBoard : Board
  12. {
  13. protected override void Dispose (bool disposing)
  14. {
  15. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  16. try {
  17. if (disposing) {
  18. }
  19. if (IsEnabledDispose) {
  20. if (nativeObj != IntPtr.Zero)
  21. aruco_CharucoBoard_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal CharucoBoard (IntPtr addr) : base (addr) { }
  32. // internal usage only
  33. public static new CharucoBoard __fromPtr__ (IntPtr addr) { return new CharucoBoard (addr); }
  34. //
  35. // C++: static Ptr_CharucoBoard cv::aruco::CharucoBoard::create(int squaresX, int squaresY, float squareLength, float markerLength, Ptr_Dictionary dictionary)
  36. //
  37. //javadoc: CharucoBoard::create(squaresX, squaresY, squareLength, markerLength, dictionary)
  38. public static CharucoBoard create (int squaresX, int squaresY, float squareLength, float markerLength, Dictionary dictionary)
  39. {
  40. if (dictionary != null) dictionary.ThrowIfDisposed ();
  41. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  42. CharucoBoard retVal = CharucoBoard.__fromPtr__(aruco_CharucoBoard_create_10(squaresX, squaresY, squareLength, markerLength, dictionary.getNativeObjAddr()));
  43. return retVal;
  44. #else
  45. return null;
  46. #endif
  47. }
  48. //
  49. // C++: Size cv::aruco::CharucoBoard::getChessboardSize()
  50. //
  51. //javadoc: CharucoBoard::getChessboardSize()
  52. public Size getChessboardSize ()
  53. {
  54. ThrowIfDisposed ();
  55. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  56. double[] tmpArray = new double[2];
  57. aruco_CharucoBoard_getChessboardSize_10(nativeObj, tmpArray);
  58. Size retVal = new Size (tmpArray);
  59. return retVal;
  60. #else
  61. return null;
  62. #endif
  63. }
  64. //
  65. // C++: float cv::aruco::CharucoBoard::getMarkerLength()
  66. //
  67. //javadoc: CharucoBoard::getMarkerLength()
  68. public float getMarkerLength ()
  69. {
  70. ThrowIfDisposed ();
  71. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  72. float retVal = aruco_CharucoBoard_getMarkerLength_10(nativeObj);
  73. return retVal;
  74. #else
  75. return -1;
  76. #endif
  77. }
  78. //
  79. // C++: float cv::aruco::CharucoBoard::getSquareLength()
  80. //
  81. //javadoc: CharucoBoard::getSquareLength()
  82. public float getSquareLength ()
  83. {
  84. ThrowIfDisposed ();
  85. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  86. float retVal = aruco_CharucoBoard_getSquareLength_10(nativeObj);
  87. return retVal;
  88. #else
  89. return -1;
  90. #endif
  91. }
  92. //
  93. // C++: void cv::aruco::CharucoBoard::draw(Size outSize, Mat& img, int marginSize = 0, int borderBits = 1)
  94. //
  95. //javadoc: CharucoBoard::draw(outSize, img, marginSize, borderBits)
  96. public void draw (Size outSize, Mat img, int marginSize, int borderBits)
  97. {
  98. ThrowIfDisposed ();
  99. if (img != null) img.ThrowIfDisposed ();
  100. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  101. aruco_CharucoBoard_draw_10(nativeObj, outSize.width, outSize.height, img.nativeObj, marginSize, borderBits);
  102. return;
  103. #else
  104. return;
  105. #endif
  106. }
  107. //javadoc: CharucoBoard::draw(outSize, img, marginSize)
  108. public void draw (Size outSize, Mat img, int marginSize)
  109. {
  110. ThrowIfDisposed ();
  111. if (img != null) img.ThrowIfDisposed ();
  112. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  113. aruco_CharucoBoard_draw_11(nativeObj, outSize.width, outSize.height, img.nativeObj, marginSize);
  114. return;
  115. #else
  116. return;
  117. #endif
  118. }
  119. //javadoc: CharucoBoard::draw(outSize, img)
  120. public void draw (Size outSize, Mat img)
  121. {
  122. ThrowIfDisposed ();
  123. if (img != null) img.ThrowIfDisposed ();
  124. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  125. aruco_CharucoBoard_draw_12(nativeObj, outSize.width, outSize.height, img.nativeObj);
  126. return;
  127. #else
  128. return;
  129. #endif
  130. }
  131. //
  132. // C++: vector_Point3f CharucoBoard::chessboardCorners
  133. //
  134. //javadoc: CharucoBoard::get_chessboardCorners()
  135. public MatOfPoint3f get_chessboardCorners ()
  136. {
  137. ThrowIfDisposed ();
  138. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  139. MatOfPoint3f retVal = MatOfPoint3f.fromNativeAddr(aruco_CharucoBoard_get_1chessboardCorners_10(nativeObj));
  140. return retVal;
  141. #else
  142. return null;
  143. #endif
  144. }
  145. //
  146. // C++: vector_vector_int CharucoBoard::nearestMarkerIdx
  147. //
  148. // Return type 'vector_vector_int' is not supported, skipping the function
  149. //
  150. // C++: vector_vector_int CharucoBoard::nearestMarkerCorners
  151. //
  152. // Return type 'vector_vector_int' is not supported, skipping the function
  153. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  154. const string LIBNAME = "__Internal";
  155. #else
  156. const string LIBNAME = "opencvforunity";
  157. #endif
  158. // C++: static Ptr_CharucoBoard cv::aruco::CharucoBoard::create(int squaresX, int squaresY, float squareLength, float markerLength, Ptr_Dictionary dictionary)
  159. [DllImport (LIBNAME)]
  160. private static extern IntPtr aruco_CharucoBoard_create_10 (int squaresX, int squaresY, float squareLength, float markerLength, IntPtr dictionary_nativeObj);
  161. // C++: Size cv::aruco::CharucoBoard::getChessboardSize()
  162. [DllImport (LIBNAME)]
  163. private static extern void aruco_CharucoBoard_getChessboardSize_10 (IntPtr nativeObj, double[] retVal);
  164. // C++: float cv::aruco::CharucoBoard::getMarkerLength()
  165. [DllImport (LIBNAME)]
  166. private static extern float aruco_CharucoBoard_getMarkerLength_10 (IntPtr nativeObj);
  167. // C++: float cv::aruco::CharucoBoard::getSquareLength()
  168. [DllImport (LIBNAME)]
  169. private static extern float aruco_CharucoBoard_getSquareLength_10 (IntPtr nativeObj);
  170. // C++: void cv::aruco::CharucoBoard::draw(Size outSize, Mat& img, int marginSize = 0, int borderBits = 1)
  171. [DllImport (LIBNAME)]
  172. private static extern void aruco_CharucoBoard_draw_10 (IntPtr nativeObj, double outSize_width, double outSize_height, IntPtr img_nativeObj, int marginSize, int borderBits);
  173. [DllImport (LIBNAME)]
  174. private static extern void aruco_CharucoBoard_draw_11 (IntPtr nativeObj, double outSize_width, double outSize_height, IntPtr img_nativeObj, int marginSize);
  175. [DllImport (LIBNAME)]
  176. private static extern void aruco_CharucoBoard_draw_12 (IntPtr nativeObj, double outSize_width, double outSize_height, IntPtr img_nativeObj);
  177. // C++: vector_Point3f CharucoBoard::chessboardCorners
  178. [DllImport (LIBNAME)]
  179. private static extern IntPtr aruco_CharucoBoard_get_1chessboardCorners_10 (IntPtr nativeObj);
  180. // native support for java finalize()
  181. [DllImport (LIBNAME)]
  182. private static extern void aruco_CharucoBoard_delete (IntPtr nativeObj);
  183. }
  184. }