DenseOpticalFlow.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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 DenseOpticalFlow
  10. //javadoc: DenseOpticalFlow
  11. public class DenseOpticalFlow : Algorithm
  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_DenseOpticalFlow_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal DenseOpticalFlow (IntPtr addr) : base (addr) { }
  32. // internal usage only
  33. public static new DenseOpticalFlow __fromPtr__ (IntPtr addr) { return new DenseOpticalFlow (addr); }
  34. //
  35. // C++: void cv::DenseOpticalFlow::calc(Mat I0, Mat I1, Mat& flow)
  36. //
  37. //javadoc: DenseOpticalFlow::calc(I0, I1, flow)
  38. public void calc (Mat I0, Mat I1, Mat flow)
  39. {
  40. ThrowIfDisposed ();
  41. if (I0 != null) I0.ThrowIfDisposed ();
  42. if (I1 != null) I1.ThrowIfDisposed ();
  43. if (flow != null) flow.ThrowIfDisposed ();
  44. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  45. video_DenseOpticalFlow_calc_10(nativeObj, I0.nativeObj, I1.nativeObj, flow.nativeObj);
  46. return;
  47. #else
  48. return;
  49. #endif
  50. }
  51. //
  52. // C++: void cv::DenseOpticalFlow::collectGarbage()
  53. //
  54. //javadoc: DenseOpticalFlow::collectGarbage()
  55. public void collectGarbage ()
  56. {
  57. ThrowIfDisposed ();
  58. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  59. video_DenseOpticalFlow_collectGarbage_10(nativeObj);
  60. return;
  61. #else
  62. return;
  63. #endif
  64. }
  65. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  66. const string LIBNAME = "__Internal";
  67. #else
  68. const string LIBNAME = "opencvforunity";
  69. #endif
  70. // C++: void cv::DenseOpticalFlow::calc(Mat I0, Mat I1, Mat& flow)
  71. [DllImport (LIBNAME)]
  72. private static extern void video_DenseOpticalFlow_calc_10 (IntPtr nativeObj, IntPtr I0_nativeObj, IntPtr I1_nativeObj, IntPtr flow_nativeObj);
  73. // C++: void cv::DenseOpticalFlow::collectGarbage()
  74. [DllImport (LIBNAME)]
  75. private static extern void video_DenseOpticalFlow_collectGarbage_10 (IntPtr nativeObj);
  76. // native support for java finalize()
  77. [DllImport (LIBNAME)]
  78. private static extern void video_DenseOpticalFlow_delete (IntPtr nativeObj);
  79. }
  80. }