Boost.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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.MlModule
  8. {
  9. // C++: class Boost
  10. //javadoc: Boost
  11. public class Boost : DTrees
  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. ml_Boost_delete (nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal Boost (IntPtr addr)
  32. : base (addr)
  33. {
  34. }
  35. // internal usage only
  36. public static new Boost __fromPtr__ (IntPtr addr)
  37. {
  38. return new Boost (addr);
  39. }
  40. // C++: enum Types
  41. public const int DISCRETE = 0;
  42. public const int REAL = 1;
  43. public const int LOGIT = 2;
  44. public const int GENTLE = 3;
  45. //
  46. // C++: static Ptr_Boost cv::ml::Boost::create()
  47. //
  48. //javadoc: Boost::create()
  49. public static new Boost create ()
  50. {
  51. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  52. Boost retVal = Boost.__fromPtr__ (ml_Boost_create_10 ());
  53. return retVal;
  54. #else
  55. return null;
  56. #endif
  57. }
  58. //
  59. // C++: static Ptr_Boost cv::ml::Boost::load(String filepath, String nodeName = String())
  60. //
  61. //javadoc: Boost::load(filepath, nodeName)
  62. public static new Boost load (string filepath, string nodeName)
  63. {
  64. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  65. Boost retVal = Boost.__fromPtr__ (ml_Boost_load_10 (filepath, nodeName));
  66. return retVal;
  67. #else
  68. return null;
  69. #endif
  70. }
  71. //javadoc: Boost::load(filepath)
  72. public static new Boost load (string filepath)
  73. {
  74. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  75. Boost retVal = Boost.__fromPtr__ (ml_Boost_load_11 (filepath));
  76. return retVal;
  77. #else
  78. return null;
  79. #endif
  80. }
  81. //
  82. // C++: double cv::ml::Boost::getWeightTrimRate()
  83. //
  84. //javadoc: Boost::getWeightTrimRate()
  85. public double getWeightTrimRate ()
  86. {
  87. ThrowIfDisposed ();
  88. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  89. double retVal = ml_Boost_getWeightTrimRate_10 (nativeObj);
  90. return retVal;
  91. #else
  92. return -1;
  93. #endif
  94. }
  95. //
  96. // C++: int cv::ml::Boost::getBoostType()
  97. //
  98. //javadoc: Boost::getBoostType()
  99. public int getBoostType ()
  100. {
  101. ThrowIfDisposed ();
  102. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  103. int retVal = ml_Boost_getBoostType_10 (nativeObj);
  104. return retVal;
  105. #else
  106. return -1;
  107. #endif
  108. }
  109. //
  110. // C++: int cv::ml::Boost::getWeakCount()
  111. //
  112. //javadoc: Boost::getWeakCount()
  113. public int getWeakCount ()
  114. {
  115. ThrowIfDisposed ();
  116. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  117. int retVal = ml_Boost_getWeakCount_10 (nativeObj);
  118. return retVal;
  119. #else
  120. return -1;
  121. #endif
  122. }
  123. //
  124. // C++: void cv::ml::Boost::setBoostType(int val)
  125. //
  126. //javadoc: Boost::setBoostType(val)
  127. public void setBoostType (int val)
  128. {
  129. ThrowIfDisposed ();
  130. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  131. ml_Boost_setBoostType_10 (nativeObj, val);
  132. return;
  133. #else
  134. return;
  135. #endif
  136. }
  137. //
  138. // C++: void cv::ml::Boost::setWeakCount(int val)
  139. //
  140. //javadoc: Boost::setWeakCount(val)
  141. public void setWeakCount (int val)
  142. {
  143. ThrowIfDisposed ();
  144. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  145. ml_Boost_setWeakCount_10 (nativeObj, val);
  146. return;
  147. #else
  148. return;
  149. #endif
  150. }
  151. //
  152. // C++: void cv::ml::Boost::setWeightTrimRate(double val)
  153. //
  154. //javadoc: Boost::setWeightTrimRate(val)
  155. public void setWeightTrimRate (double val)
  156. {
  157. ThrowIfDisposed ();
  158. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  159. ml_Boost_setWeightTrimRate_10 (nativeObj, val);
  160. return;
  161. #else
  162. return;
  163. #endif
  164. }
  165. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  166. const string LIBNAME = "__Internal";
  167. #else
  168. const string LIBNAME = "opencvforunity";
  169. #endif
  170. // C++: static Ptr_Boost cv::ml::Boost::create()
  171. [DllImport (LIBNAME)]
  172. private static extern IntPtr ml_Boost_create_10 ();
  173. // C++: static Ptr_Boost cv::ml::Boost::load(String filepath, String nodeName = String())
  174. [DllImport (LIBNAME)]
  175. private static extern IntPtr ml_Boost_load_10 (string filepath, string nodeName);
  176. [DllImport (LIBNAME)]
  177. private static extern IntPtr ml_Boost_load_11 (string filepath);
  178. // C++: double cv::ml::Boost::getWeightTrimRate()
  179. [DllImport (LIBNAME)]
  180. private static extern double ml_Boost_getWeightTrimRate_10 (IntPtr nativeObj);
  181. // C++: int cv::ml::Boost::getBoostType()
  182. [DllImport (LIBNAME)]
  183. private static extern int ml_Boost_getBoostType_10 (IntPtr nativeObj);
  184. // C++: int cv::ml::Boost::getWeakCount()
  185. [DllImport (LIBNAME)]
  186. private static extern int ml_Boost_getWeakCount_10 (IntPtr nativeObj);
  187. // C++: void cv::ml::Boost::setBoostType(int val)
  188. [DllImport (LIBNAME)]
  189. private static extern void ml_Boost_setBoostType_10 (IntPtr nativeObj, int val);
  190. // C++: void cv::ml::Boost::setWeakCount(int val)
  191. [DllImport (LIBNAME)]
  192. private static extern void ml_Boost_setWeakCount_10 (IntPtr nativeObj, int val);
  193. // C++: void cv::ml::Boost::setWeightTrimRate(double val)
  194. [DllImport (LIBNAME)]
  195. private static extern void ml_Boost_setWeightTrimRate_10 (IntPtr nativeObj, double val);
  196. // native support for java finalize()
  197. [DllImport (LIBNAME)]
  198. private static extern void ml_Boost_delete (IntPtr nativeObj);
  199. }
  200. }