SparseMatchInterpolator.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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.XimgprocModule
  8. {
  9. // C++: class SparseMatchInterpolator
  10. //javadoc: SparseMatchInterpolator
  11. public class SparseMatchInterpolator : 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. ximgproc_SparseMatchInterpolator_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal SparseMatchInterpolator (IntPtr addr) : base (addr) { }
  32. // internal usage only
  33. public static new SparseMatchInterpolator __fromPtr__ (IntPtr addr) { return new SparseMatchInterpolator (addr); }
  34. //
  35. // C++: void cv::ximgproc::SparseMatchInterpolator::interpolate(Mat from_image, Mat from_points, Mat to_image, Mat to_points, Mat& dense_flow)
  36. //
  37. //javadoc: SparseMatchInterpolator::interpolate(from_image, from_points, to_image, to_points, dense_flow)
  38. public void interpolate (Mat from_image, Mat from_points, Mat to_image, Mat to_points, Mat dense_flow)
  39. {
  40. ThrowIfDisposed ();
  41. if (from_image != null) from_image.ThrowIfDisposed ();
  42. if (from_points != null) from_points.ThrowIfDisposed ();
  43. if (to_image != null) to_image.ThrowIfDisposed ();
  44. if (to_points != null) to_points.ThrowIfDisposed ();
  45. if (dense_flow != null) dense_flow.ThrowIfDisposed ();
  46. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  47. ximgproc_SparseMatchInterpolator_interpolate_10(nativeObj, from_image.nativeObj, from_points.nativeObj, to_image.nativeObj, to_points.nativeObj, dense_flow.nativeObj);
  48. return;
  49. #else
  50. return;
  51. #endif
  52. }
  53. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  54. const string LIBNAME = "__Internal";
  55. #else
  56. const string LIBNAME = "opencvforunity";
  57. #endif
  58. // C++: void cv::ximgproc::SparseMatchInterpolator::interpolate(Mat from_image, Mat from_points, Mat to_image, Mat to_points, Mat& dense_flow)
  59. [DllImport (LIBNAME)]
  60. private static extern void ximgproc_SparseMatchInterpolator_interpolate_10 (IntPtr nativeObj, IntPtr from_image_nativeObj, IntPtr from_points_nativeObj, IntPtr to_image_nativeObj, IntPtr to_points_nativeObj, IntPtr dense_flow_nativeObj);
  61. // native support for java finalize()
  62. [DllImport (LIBNAME)]
  63. private static extern void ximgproc_SparseMatchInterpolator_delete (IntPtr nativeObj);
  64. }
  65. }