SparseMatchInterpolator.cs 2.8 KB

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