SparsePyrLKOpticalFlow.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  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.VideoModule
  8. {
  9. // C++: class SparsePyrLKOpticalFlow
  10. //javadoc: SparsePyrLKOpticalFlow
  11. public class SparsePyrLKOpticalFlow : SparseOpticalFlow
  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. video_SparsePyrLKOpticalFlow_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal SparsePyrLKOpticalFlow (IntPtr addr) : base (addr) { }
  32. // internal usage only
  33. public static new SparsePyrLKOpticalFlow __fromPtr__ (IntPtr addr) { return new SparsePyrLKOpticalFlow (addr); }
  34. //
  35. // C++: static Ptr_SparsePyrLKOpticalFlow cv::SparsePyrLKOpticalFlow::create(Size winSize = Size(21, 21), int maxLevel = 3, TermCriteria crit = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 0.01), int flags = 0, double minEigThreshold = 1e-4)
  36. //
  37. //javadoc: SparsePyrLKOpticalFlow::create(winSize, maxLevel, crit, flags, minEigThreshold)
  38. public static SparsePyrLKOpticalFlow create (Size winSize, int maxLevel, TermCriteria crit, int flags, double minEigThreshold)
  39. {
  40. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  41. SparsePyrLKOpticalFlow retVal = SparsePyrLKOpticalFlow.__fromPtr__(video_SparsePyrLKOpticalFlow_create_10(winSize.width, winSize.height, maxLevel, crit.type, crit.maxCount, crit.epsilon, flags, minEigThreshold));
  42. return retVal;
  43. #else
  44. return null;
  45. #endif
  46. }
  47. //javadoc: SparsePyrLKOpticalFlow::create(winSize, maxLevel, crit, flags)
  48. public static SparsePyrLKOpticalFlow create (Size winSize, int maxLevel, TermCriteria crit, int flags)
  49. {
  50. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  51. SparsePyrLKOpticalFlow retVal = SparsePyrLKOpticalFlow.__fromPtr__(video_SparsePyrLKOpticalFlow_create_11(winSize.width, winSize.height, maxLevel, crit.type, crit.maxCount, crit.epsilon, flags));
  52. return retVal;
  53. #else
  54. return null;
  55. #endif
  56. }
  57. //javadoc: SparsePyrLKOpticalFlow::create(winSize, maxLevel, crit)
  58. public static SparsePyrLKOpticalFlow create (Size winSize, int maxLevel, TermCriteria crit)
  59. {
  60. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  61. SparsePyrLKOpticalFlow retVal = SparsePyrLKOpticalFlow.__fromPtr__(video_SparsePyrLKOpticalFlow_create_12(winSize.width, winSize.height, maxLevel, crit.type, crit.maxCount, crit.epsilon));
  62. return retVal;
  63. #else
  64. return null;
  65. #endif
  66. }
  67. //javadoc: SparsePyrLKOpticalFlow::create(winSize, maxLevel)
  68. public static SparsePyrLKOpticalFlow create (Size winSize, int maxLevel)
  69. {
  70. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  71. SparsePyrLKOpticalFlow retVal = SparsePyrLKOpticalFlow.__fromPtr__(video_SparsePyrLKOpticalFlow_create_13(winSize.width, winSize.height, maxLevel));
  72. return retVal;
  73. #else
  74. return null;
  75. #endif
  76. }
  77. //javadoc: SparsePyrLKOpticalFlow::create(winSize)
  78. public static SparsePyrLKOpticalFlow create (Size winSize)
  79. {
  80. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  81. SparsePyrLKOpticalFlow retVal = SparsePyrLKOpticalFlow.__fromPtr__(video_SparsePyrLKOpticalFlow_create_14(winSize.width, winSize.height));
  82. return retVal;
  83. #else
  84. return null;
  85. #endif
  86. }
  87. //javadoc: SparsePyrLKOpticalFlow::create()
  88. public static SparsePyrLKOpticalFlow create ()
  89. {
  90. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  91. SparsePyrLKOpticalFlow retVal = SparsePyrLKOpticalFlow.__fromPtr__(video_SparsePyrLKOpticalFlow_create_15());
  92. return retVal;
  93. #else
  94. return null;
  95. #endif
  96. }
  97. //
  98. // C++: Size cv::SparsePyrLKOpticalFlow::getWinSize()
  99. //
  100. //javadoc: SparsePyrLKOpticalFlow::getWinSize()
  101. public Size getWinSize ()
  102. {
  103. ThrowIfDisposed ();
  104. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  105. double[] tmpArray = new double[2];
  106. video_SparsePyrLKOpticalFlow_getWinSize_10(nativeObj, tmpArray);
  107. Size retVal = new Size (tmpArray);
  108. return retVal;
  109. #else
  110. return null;
  111. #endif
  112. }
  113. //
  114. // C++: TermCriteria cv::SparsePyrLKOpticalFlow::getTermCriteria()
  115. //
  116. //javadoc: SparsePyrLKOpticalFlow::getTermCriteria()
  117. public TermCriteria getTermCriteria ()
  118. {
  119. ThrowIfDisposed ();
  120. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  121. double[] tmpArray = new double[3];
  122. video_SparsePyrLKOpticalFlow_getTermCriteria_10(nativeObj, tmpArray);
  123. TermCriteria retVal = new TermCriteria (tmpArray);
  124. return retVal;
  125. #else
  126. return null;
  127. #endif
  128. }
  129. //
  130. // C++: double cv::SparsePyrLKOpticalFlow::getMinEigThreshold()
  131. //
  132. //javadoc: SparsePyrLKOpticalFlow::getMinEigThreshold()
  133. public double getMinEigThreshold ()
  134. {
  135. ThrowIfDisposed ();
  136. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  137. double retVal = video_SparsePyrLKOpticalFlow_getMinEigThreshold_10(nativeObj);
  138. return retVal;
  139. #else
  140. return -1;
  141. #endif
  142. }
  143. //
  144. // C++: int cv::SparsePyrLKOpticalFlow::getFlags()
  145. //
  146. //javadoc: SparsePyrLKOpticalFlow::getFlags()
  147. public int getFlags ()
  148. {
  149. ThrowIfDisposed ();
  150. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  151. int retVal = video_SparsePyrLKOpticalFlow_getFlags_10(nativeObj);
  152. return retVal;
  153. #else
  154. return -1;
  155. #endif
  156. }
  157. //
  158. // C++: int cv::SparsePyrLKOpticalFlow::getMaxLevel()
  159. //
  160. //javadoc: SparsePyrLKOpticalFlow::getMaxLevel()
  161. public int getMaxLevel ()
  162. {
  163. ThrowIfDisposed ();
  164. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  165. int retVal = video_SparsePyrLKOpticalFlow_getMaxLevel_10(nativeObj);
  166. return retVal;
  167. #else
  168. return -1;
  169. #endif
  170. }
  171. //
  172. // C++: void cv::SparsePyrLKOpticalFlow::setFlags(int flags)
  173. //
  174. //javadoc: SparsePyrLKOpticalFlow::setFlags(flags)
  175. public void setFlags (int flags)
  176. {
  177. ThrowIfDisposed ();
  178. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  179. video_SparsePyrLKOpticalFlow_setFlags_10(nativeObj, flags);
  180. return;
  181. #else
  182. return;
  183. #endif
  184. }
  185. //
  186. // C++: void cv::SparsePyrLKOpticalFlow::setMaxLevel(int maxLevel)
  187. //
  188. //javadoc: SparsePyrLKOpticalFlow::setMaxLevel(maxLevel)
  189. public void setMaxLevel (int maxLevel)
  190. {
  191. ThrowIfDisposed ();
  192. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  193. video_SparsePyrLKOpticalFlow_setMaxLevel_10(nativeObj, maxLevel);
  194. return;
  195. #else
  196. return;
  197. #endif
  198. }
  199. //
  200. // C++: void cv::SparsePyrLKOpticalFlow::setMinEigThreshold(double minEigThreshold)
  201. //
  202. //javadoc: SparsePyrLKOpticalFlow::setMinEigThreshold(minEigThreshold)
  203. public void setMinEigThreshold (double minEigThreshold)
  204. {
  205. ThrowIfDisposed ();
  206. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  207. video_SparsePyrLKOpticalFlow_setMinEigThreshold_10(nativeObj, minEigThreshold);
  208. return;
  209. #else
  210. return;
  211. #endif
  212. }
  213. //
  214. // C++: void cv::SparsePyrLKOpticalFlow::setTermCriteria(TermCriteria crit)
  215. //
  216. //javadoc: SparsePyrLKOpticalFlow::setTermCriteria(crit)
  217. public void setTermCriteria (TermCriteria crit)
  218. {
  219. ThrowIfDisposed ();
  220. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  221. video_SparsePyrLKOpticalFlow_setTermCriteria_10(nativeObj, crit.type, crit.maxCount, crit.epsilon);
  222. return;
  223. #else
  224. return;
  225. #endif
  226. }
  227. //
  228. // C++: void cv::SparsePyrLKOpticalFlow::setWinSize(Size winSize)
  229. //
  230. //javadoc: SparsePyrLKOpticalFlow::setWinSize(winSize)
  231. public void setWinSize (Size winSize)
  232. {
  233. ThrowIfDisposed ();
  234. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  235. video_SparsePyrLKOpticalFlow_setWinSize_10(nativeObj, winSize.width, winSize.height);
  236. return;
  237. #else
  238. return;
  239. #endif
  240. }
  241. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  242. const string LIBNAME = "__Internal";
  243. #else
  244. const string LIBNAME = "opencvforunity";
  245. #endif
  246. // C++: static Ptr_SparsePyrLKOpticalFlow cv::SparsePyrLKOpticalFlow::create(Size winSize = Size(21, 21), int maxLevel = 3, TermCriteria crit = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 0.01), int flags = 0, double minEigThreshold = 1e-4)
  247. [DllImport (LIBNAME)]
  248. private static extern IntPtr video_SparsePyrLKOpticalFlow_create_10 (double winSize_width, double winSize_height, int maxLevel, int crit_type, int crit_maxCount, double crit_epsilon, int flags, double minEigThreshold);
  249. [DllImport (LIBNAME)]
  250. private static extern IntPtr video_SparsePyrLKOpticalFlow_create_11 (double winSize_width, double winSize_height, int maxLevel, int crit_type, int crit_maxCount, double crit_epsilon, int flags);
  251. [DllImport (LIBNAME)]
  252. private static extern IntPtr video_SparsePyrLKOpticalFlow_create_12 (double winSize_width, double winSize_height, int maxLevel, int crit_type, int crit_maxCount, double crit_epsilon);
  253. [DllImport (LIBNAME)]
  254. private static extern IntPtr video_SparsePyrLKOpticalFlow_create_13 (double winSize_width, double winSize_height, int maxLevel);
  255. [DllImport (LIBNAME)]
  256. private static extern IntPtr video_SparsePyrLKOpticalFlow_create_14 (double winSize_width, double winSize_height);
  257. [DllImport (LIBNAME)]
  258. private static extern IntPtr video_SparsePyrLKOpticalFlow_create_15 ();
  259. // C++: Size cv::SparsePyrLKOpticalFlow::getWinSize()
  260. [DllImport (LIBNAME)]
  261. private static extern void video_SparsePyrLKOpticalFlow_getWinSize_10 (IntPtr nativeObj, double[] retVal);
  262. // C++: TermCriteria cv::SparsePyrLKOpticalFlow::getTermCriteria()
  263. [DllImport (LIBNAME)]
  264. private static extern void video_SparsePyrLKOpticalFlow_getTermCriteria_10 (IntPtr nativeObj, double[] retVal);
  265. // C++: double cv::SparsePyrLKOpticalFlow::getMinEigThreshold()
  266. [DllImport (LIBNAME)]
  267. private static extern double video_SparsePyrLKOpticalFlow_getMinEigThreshold_10 (IntPtr nativeObj);
  268. // C++: int cv::SparsePyrLKOpticalFlow::getFlags()
  269. [DllImport (LIBNAME)]
  270. private static extern int video_SparsePyrLKOpticalFlow_getFlags_10 (IntPtr nativeObj);
  271. // C++: int cv::SparsePyrLKOpticalFlow::getMaxLevel()
  272. [DllImport (LIBNAME)]
  273. private static extern int video_SparsePyrLKOpticalFlow_getMaxLevel_10 (IntPtr nativeObj);
  274. // C++: void cv::SparsePyrLKOpticalFlow::setFlags(int flags)
  275. [DllImport (LIBNAME)]
  276. private static extern void video_SparsePyrLKOpticalFlow_setFlags_10 (IntPtr nativeObj, int flags);
  277. // C++: void cv::SparsePyrLKOpticalFlow::setMaxLevel(int maxLevel)
  278. [DllImport (LIBNAME)]
  279. private static extern void video_SparsePyrLKOpticalFlow_setMaxLevel_10 (IntPtr nativeObj, int maxLevel);
  280. // C++: void cv::SparsePyrLKOpticalFlow::setMinEigThreshold(double minEigThreshold)
  281. [DllImport (LIBNAME)]
  282. private static extern void video_SparsePyrLKOpticalFlow_setMinEigThreshold_10 (IntPtr nativeObj, double minEigThreshold);
  283. // C++: void cv::SparsePyrLKOpticalFlow::setTermCriteria(TermCriteria crit)
  284. [DllImport (LIBNAME)]
  285. private static extern void video_SparsePyrLKOpticalFlow_setTermCriteria_10 (IntPtr nativeObj, int crit_type, int crit_maxCount, double crit_epsilon);
  286. // C++: void cv::SparsePyrLKOpticalFlow::setWinSize(Size winSize)
  287. [DllImport (LIBNAME)]
  288. private static extern void video_SparsePyrLKOpticalFlow_setWinSize_10 (IntPtr nativeObj, double winSize_width, double winSize_height);
  289. // native support for java finalize()
  290. [DllImport (LIBNAME)]
  291. private static extern void video_SparsePyrLKOpticalFlow_delete (IntPtr nativeObj);
  292. }
  293. }