MarrHildrethHash.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. using OpenCVForUnity.CoreModule;
  2. using OpenCVForUnity.UtilsModule;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Runtime.InteropServices;
  6. namespace OpenCVForUnity.Img_hashModule
  7. {
  8. // C++: class MarrHildrethHash
  9. /**
  10. * Marr-Hildreth Operator Based Hash, slowest but more discriminative.
  11. *
  12. * See CITE: zauner2010implementation for details.
  13. */
  14. public class MarrHildrethHash : ImgHashBase
  15. {
  16. protected override void Dispose(bool disposing)
  17. {
  18. try
  19. {
  20. if (disposing)
  21. {
  22. }
  23. if (IsEnabledDispose)
  24. {
  25. if (nativeObj != IntPtr.Zero)
  26. img_1hash_MarrHildrethHash_delete(nativeObj);
  27. nativeObj = IntPtr.Zero;
  28. }
  29. }
  30. finally
  31. {
  32. base.Dispose(disposing);
  33. }
  34. }
  35. protected internal MarrHildrethHash(IntPtr addr) : base(addr) { }
  36. // internal usage only
  37. public static new MarrHildrethHash __fromPtr__(IntPtr addr) { return new MarrHildrethHash(addr); }
  38. //
  39. // C++: float cv::img_hash::MarrHildrethHash::getAlpha()
  40. //
  41. /**
  42. * self explain
  43. * return automatically generated
  44. */
  45. public float getAlpha()
  46. {
  47. ThrowIfDisposed();
  48. return img_1hash_MarrHildrethHash_getAlpha_10(nativeObj);
  49. }
  50. //
  51. // C++: float cv::img_hash::MarrHildrethHash::getScale()
  52. //
  53. /**
  54. * self explain
  55. * return automatically generated
  56. */
  57. public float getScale()
  58. {
  59. ThrowIfDisposed();
  60. return img_1hash_MarrHildrethHash_getScale_10(nativeObj);
  61. }
  62. //
  63. // C++: void cv::img_hash::MarrHildrethHash::setKernelParam(float alpha, float scale)
  64. //
  65. /**
  66. * Set Mh kernel parameters
  67. * param alpha int scale factor for marr wavelet (default=2).
  68. * param scale int level of scale factor (default = 1)
  69. */
  70. public void setKernelParam(float alpha, float scale)
  71. {
  72. ThrowIfDisposed();
  73. img_1hash_MarrHildrethHash_setKernelParam_10(nativeObj, alpha, scale);
  74. }
  75. //
  76. // C++: static Ptr_MarrHildrethHash cv::img_hash::MarrHildrethHash::create(float alpha = 2.0f, float scale = 1.0f)
  77. //
  78. /**
  79. * param alpha int scale factor for marr wavelet (default=2).
  80. * param scale int level of scale factor (default = 1)
  81. * return automatically generated
  82. */
  83. public static MarrHildrethHash create(float alpha, float scale)
  84. {
  85. return MarrHildrethHash.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(img_1hash_MarrHildrethHash_create_10(alpha, scale)));
  86. }
  87. /**
  88. * param alpha int scale factor for marr wavelet (default=2).
  89. * return automatically generated
  90. */
  91. public static MarrHildrethHash create(float alpha)
  92. {
  93. return MarrHildrethHash.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(img_1hash_MarrHildrethHash_create_11(alpha)));
  94. }
  95. /**
  96. * return automatically generated
  97. */
  98. public static MarrHildrethHash create()
  99. {
  100. return MarrHildrethHash.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(img_1hash_MarrHildrethHash_create_12()));
  101. }
  102. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  103. const string LIBNAME = "__Internal";
  104. #else
  105. const string LIBNAME = "opencvforunity";
  106. #endif
  107. // C++: float cv::img_hash::MarrHildrethHash::getAlpha()
  108. [DllImport(LIBNAME)]
  109. private static extern float img_1hash_MarrHildrethHash_getAlpha_10(IntPtr nativeObj);
  110. // C++: float cv::img_hash::MarrHildrethHash::getScale()
  111. [DllImport(LIBNAME)]
  112. private static extern float img_1hash_MarrHildrethHash_getScale_10(IntPtr nativeObj);
  113. // C++: void cv::img_hash::MarrHildrethHash::setKernelParam(float alpha, float scale)
  114. [DllImport(LIBNAME)]
  115. private static extern void img_1hash_MarrHildrethHash_setKernelParam_10(IntPtr nativeObj, float alpha, float scale);
  116. // C++: static Ptr_MarrHildrethHash cv::img_hash::MarrHildrethHash::create(float alpha = 2.0f, float scale = 1.0f)
  117. [DllImport(LIBNAME)]
  118. private static extern IntPtr img_1hash_MarrHildrethHash_create_10(float alpha, float scale);
  119. [DllImport(LIBNAME)]
  120. private static extern IntPtr img_1hash_MarrHildrethHash_create_11(float alpha);
  121. [DllImport(LIBNAME)]
  122. private static extern IntPtr img_1hash_MarrHildrethHash_create_12();
  123. // native support for java finalize()
  124. [DllImport(LIBNAME)]
  125. private static extern void img_1hash_MarrHildrethHash_delete(IntPtr nativeObj);
  126. }
  127. }