PhaseUnwrapping.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #if !UNITY_WEBGL
  2. using OpenCVForUnity.CoreModule;
  3. using OpenCVForUnity.UtilsModule;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Runtime.InteropServices;
  7. namespace OpenCVForUnity.Phase_unwrappingModule
  8. {
  9. // C++: class PhaseUnwrapping
  10. /**
  11. * Abstract base class for phase unwrapping.
  12. */
  13. public class PhaseUnwrapping : Algorithm
  14. {
  15. protected override void Dispose(bool disposing)
  16. {
  17. try
  18. {
  19. if (disposing)
  20. {
  21. }
  22. if (IsEnabledDispose)
  23. {
  24. if (nativeObj != IntPtr.Zero)
  25. phase_1unwrapping_PhaseUnwrapping_delete(nativeObj);
  26. nativeObj = IntPtr.Zero;
  27. }
  28. }
  29. finally
  30. {
  31. base.Dispose(disposing);
  32. }
  33. }
  34. protected internal PhaseUnwrapping(IntPtr addr) : base(addr) { }
  35. // internal usage only
  36. public static new PhaseUnwrapping __fromPtr__(IntPtr addr) { return new PhaseUnwrapping(addr); }
  37. //
  38. // C++: void cv::phase_unwrapping::PhaseUnwrapping::unwrapPhaseMap(Mat wrappedPhaseMap, Mat& unwrappedPhaseMap, Mat shadowMask = Mat())
  39. //
  40. /**
  41. * Unwraps a 2D phase map.
  42. *
  43. * param wrappedPhaseMap The wrapped phase map of type CV_32FC1 that needs to be unwrapped.
  44. * param unwrappedPhaseMap The unwrapped phase map.
  45. * param shadowMask Optional CV_8UC1 mask image used when some pixels do not hold any phase information in the wrapped phase map.
  46. */
  47. public void unwrapPhaseMap(Mat wrappedPhaseMap, Mat unwrappedPhaseMap, Mat shadowMask)
  48. {
  49. ThrowIfDisposed();
  50. if (wrappedPhaseMap != null) wrappedPhaseMap.ThrowIfDisposed();
  51. if (unwrappedPhaseMap != null) unwrappedPhaseMap.ThrowIfDisposed();
  52. if (shadowMask != null) shadowMask.ThrowIfDisposed();
  53. phase_1unwrapping_PhaseUnwrapping_unwrapPhaseMap_10(nativeObj, wrappedPhaseMap.nativeObj, unwrappedPhaseMap.nativeObj, shadowMask.nativeObj);
  54. }
  55. /**
  56. * Unwraps a 2D phase map.
  57. *
  58. * param wrappedPhaseMap The wrapped phase map of type CV_32FC1 that needs to be unwrapped.
  59. * param unwrappedPhaseMap The unwrapped phase map.
  60. */
  61. public void unwrapPhaseMap(Mat wrappedPhaseMap, Mat unwrappedPhaseMap)
  62. {
  63. ThrowIfDisposed();
  64. if (wrappedPhaseMap != null) wrappedPhaseMap.ThrowIfDisposed();
  65. if (unwrappedPhaseMap != null) unwrappedPhaseMap.ThrowIfDisposed();
  66. phase_1unwrapping_PhaseUnwrapping_unwrapPhaseMap_11(nativeObj, wrappedPhaseMap.nativeObj, unwrappedPhaseMap.nativeObj);
  67. }
  68. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  69. const string LIBNAME = "__Internal";
  70. #else
  71. const string LIBNAME = "opencvforunity";
  72. #endif
  73. // C++: void cv::phase_unwrapping::PhaseUnwrapping::unwrapPhaseMap(Mat wrappedPhaseMap, Mat& unwrappedPhaseMap, Mat shadowMask = Mat())
  74. [DllImport(LIBNAME)]
  75. private static extern void phase_1unwrapping_PhaseUnwrapping_unwrapPhaseMap_10(IntPtr nativeObj, IntPtr wrappedPhaseMap_nativeObj, IntPtr unwrappedPhaseMap_nativeObj, IntPtr shadowMask_nativeObj);
  76. [DllImport(LIBNAME)]
  77. private static extern void phase_1unwrapping_PhaseUnwrapping_unwrapPhaseMap_11(IntPtr nativeObj, IntPtr wrappedPhaseMap_nativeObj, IntPtr unwrappedPhaseMap_nativeObj);
  78. // native support for java finalize()
  79. [DllImport(LIBNAME)]
  80. private static extern void phase_1unwrapping_PhaseUnwrapping_delete(IntPtr nativeObj);
  81. }
  82. }
  83. #endif