ParamGrid.cs 6.3 KB

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