Mapper.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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.RegModule
  8. {
  9. // C++: class Mapper
  10. //javadoc: Mapper
  11. public class Mapper : DisposableOpenCVObject
  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. reg_Mapper_delete (nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal Mapper (IntPtr addr)
  32. : base (addr)
  33. {
  34. }
  35. public IntPtr getNativeObjAddr ()
  36. {
  37. return nativeObj;
  38. }
  39. // internal usage only
  40. public static Mapper __fromPtr__ (IntPtr addr)
  41. {
  42. return new Mapper (addr);
  43. }
  44. //
  45. // C++: Ptr_Map cv::reg::Mapper::calculate(Mat img1, Mat img2, Ptr_Map init = cv::Ptr<Map>())
  46. //
  47. //javadoc: Mapper::calculate(img1, img2, init)
  48. public virtual Map calculate (Mat img1, Mat img2, Map init)
  49. {
  50. ThrowIfDisposed ();
  51. if (img1 != null)
  52. img1.ThrowIfDisposed ();
  53. if (img2 != null)
  54. img2.ThrowIfDisposed ();
  55. if (init != null)
  56. init.ThrowIfDisposed ();
  57. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  58. Map retVal = Map.__fromPtr__ (reg_Mapper_calculate_10 (nativeObj, img1.nativeObj, img2.nativeObj, init.getNativeObjAddr ()));
  59. return retVal;
  60. #else
  61. return null;
  62. #endif
  63. }
  64. //javadoc: Mapper::calculate(img1, img2)
  65. public virtual Map calculate (Mat img1, Mat img2)
  66. {
  67. ThrowIfDisposed ();
  68. if (img1 != null)
  69. img1.ThrowIfDisposed ();
  70. if (img2 != null)
  71. img2.ThrowIfDisposed ();
  72. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  73. Map retVal = Map.__fromPtr__ (reg_Mapper_calculate_11 (nativeObj, img1.nativeObj, img2.nativeObj));
  74. return retVal;
  75. #else
  76. return null;
  77. #endif
  78. }
  79. //
  80. // C++: Ptr_Map cv::reg::Mapper::getMap()
  81. //
  82. //javadoc: Mapper::getMap()
  83. public virtual Map getMap ()
  84. {
  85. ThrowIfDisposed ();
  86. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  87. Map retVal = Map.__fromPtr__ (reg_Mapper_getMap_10 (nativeObj));
  88. return retVal;
  89. #else
  90. return null;
  91. #endif
  92. }
  93. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  94. const string LIBNAME = "__Internal";
  95. #else
  96. const string LIBNAME = "opencvforunity";
  97. #endif
  98. // C++: Ptr_Map cv::reg::Mapper::calculate(Mat img1, Mat img2, Ptr_Map init = cv::Ptr<Map>())
  99. [DllImport (LIBNAME)]
  100. private static extern IntPtr reg_Mapper_calculate_10 (IntPtr nativeObj, IntPtr img1_nativeObj, IntPtr img2_nativeObj, IntPtr init_nativeObj);
  101. [DllImport (LIBNAME)]
  102. private static extern IntPtr reg_Mapper_calculate_11 (IntPtr nativeObj, IntPtr img1_nativeObj, IntPtr img2_nativeObj);
  103. // C++: Ptr_Map cv::reg::Mapper::getMap()
  104. [DllImport (LIBNAME)]
  105. private static extern IntPtr reg_Mapper_getMap_10 (IntPtr nativeObj);
  106. // native support for java finalize()
  107. [DllImport (LIBNAME)]
  108. private static extern void reg_Mapper_delete (IntPtr nativeObj);
  109. }
  110. }