ParamGrid.cs 7.0 KB

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