BOWTrainer.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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.Features2dModule
  8. {
  9. // C++: class BOWTrainer
  10. //javadoc: BOWTrainer
  11. public class BOWTrainer : DisposableOpenCVObject
  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. features2d_BOWTrainer_delete (nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal BOWTrainer (IntPtr addr)
  32. : base (addr)
  33. {
  34. }
  35. public IntPtr getNativeObjAddr ()
  36. {
  37. return nativeObj;
  38. }
  39. // internal usage only
  40. public static BOWTrainer __fromPtr__ (IntPtr addr)
  41. {
  42. return new BOWTrainer (addr);
  43. }
  44. //
  45. // C++: Mat cv::BOWTrainer::cluster(Mat descriptors)
  46. //
  47. //javadoc: BOWTrainer::cluster(descriptors)
  48. public virtual Mat cluster (Mat descriptors)
  49. {
  50. ThrowIfDisposed ();
  51. if (descriptors != null)
  52. descriptors.ThrowIfDisposed ();
  53. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  54. Mat retVal = new Mat (features2d_BOWTrainer_cluster_10 (nativeObj, descriptors.nativeObj));
  55. return retVal;
  56. #else
  57. return null;
  58. #endif
  59. }
  60. //
  61. // C++: Mat cv::BOWTrainer::cluster()
  62. //
  63. //javadoc: BOWTrainer::cluster()
  64. public virtual Mat cluster ()
  65. {
  66. ThrowIfDisposed ();
  67. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  68. Mat retVal = new Mat (features2d_BOWTrainer_cluster_11 (nativeObj));
  69. return retVal;
  70. #else
  71. return null;
  72. #endif
  73. }
  74. //
  75. // C++: int cv::BOWTrainer::descriptorsCount()
  76. //
  77. //javadoc: BOWTrainer::descriptorsCount()
  78. public int descriptorsCount ()
  79. {
  80. ThrowIfDisposed ();
  81. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  82. int retVal = features2d_BOWTrainer_descriptorsCount_10 (nativeObj);
  83. return retVal;
  84. #else
  85. return -1;
  86. #endif
  87. }
  88. //
  89. // C++: vector_Mat cv::BOWTrainer::getDescriptors()
  90. //
  91. //javadoc: BOWTrainer::getDescriptors()
  92. public List<Mat> getDescriptors ()
  93. {
  94. ThrowIfDisposed ();
  95. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  96. List<Mat> retVal = new List<Mat> ();
  97. Mat retValMat = new Mat (features2d_BOWTrainer_getDescriptors_10 (nativeObj));
  98. Converters.Mat_to_vector_Mat (retValMat, retVal);
  99. return retVal;
  100. #else
  101. return null;
  102. #endif
  103. }
  104. //
  105. // C++: void cv::BOWTrainer::add(Mat descriptors)
  106. //
  107. //javadoc: BOWTrainer::add(descriptors)
  108. public void add (Mat descriptors)
  109. {
  110. ThrowIfDisposed ();
  111. if (descriptors != null)
  112. descriptors.ThrowIfDisposed ();
  113. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  114. features2d_BOWTrainer_add_10 (nativeObj, descriptors.nativeObj);
  115. return;
  116. #else
  117. return;
  118. #endif
  119. }
  120. //
  121. // C++: void cv::BOWTrainer::clear()
  122. //
  123. //javadoc: BOWTrainer::clear()
  124. public void clear ()
  125. {
  126. ThrowIfDisposed ();
  127. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  128. features2d_BOWTrainer_clear_10 (nativeObj);
  129. return;
  130. #else
  131. return;
  132. #endif
  133. }
  134. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  135. const string LIBNAME = "__Internal";
  136. #else
  137. const string LIBNAME = "opencvforunity";
  138. #endif
  139. // C++: Mat cv::BOWTrainer::cluster(Mat descriptors)
  140. [DllImport (LIBNAME)]
  141. private static extern IntPtr features2d_BOWTrainer_cluster_10 (IntPtr nativeObj, IntPtr descriptors_nativeObj);
  142. // C++: Mat cv::BOWTrainer::cluster()
  143. [DllImport (LIBNAME)]
  144. private static extern IntPtr features2d_BOWTrainer_cluster_11 (IntPtr nativeObj);
  145. // C++: int cv::BOWTrainer::descriptorsCount()
  146. [DllImport (LIBNAME)]
  147. private static extern int features2d_BOWTrainer_descriptorsCount_10 (IntPtr nativeObj);
  148. // C++: vector_Mat cv::BOWTrainer::getDescriptors()
  149. [DllImport (LIBNAME)]
  150. private static extern IntPtr features2d_BOWTrainer_getDescriptors_10 (IntPtr nativeObj);
  151. // C++: void cv::BOWTrainer::add(Mat descriptors)
  152. [DllImport (LIBNAME)]
  153. private static extern void features2d_BOWTrainer_add_10 (IntPtr nativeObj, IntPtr descriptors_nativeObj);
  154. // C++: void cv::BOWTrainer::clear()
  155. [DllImport (LIBNAME)]
  156. private static extern void features2d_BOWTrainer_clear_10 (IntPtr nativeObj);
  157. // native support for java finalize()
  158. [DllImport (LIBNAME)]
  159. private static extern void features2d_BOWTrainer_delete (IntPtr nativeObj);
  160. }
  161. }