Boost.cs 6.1 KB

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