RadialVarianceHash.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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 RadialVarianceHash
  9. /**
  10. * Image hash based on Radon transform.
  11. *
  12. * See CITE: tang2012perceptual for details.
  13. */
  14. public class RadialVarianceHash : 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_RadialVarianceHash_delete(nativeObj);
  27. nativeObj = IntPtr.Zero;
  28. }
  29. }
  30. finally
  31. {
  32. base.Dispose(disposing);
  33. }
  34. }
  35. protected internal RadialVarianceHash(IntPtr addr) : base(addr) { }
  36. // internal usage only
  37. public static new RadialVarianceHash __fromPtr__(IntPtr addr) { return new RadialVarianceHash(addr); }
  38. //
  39. // C++: static Ptr_RadialVarianceHash cv::img_hash::RadialVarianceHash::create(double sigma = 1, int numOfAngleLine = 180)
  40. //
  41. public static RadialVarianceHash create(double sigma, int numOfAngleLine)
  42. {
  43. return RadialVarianceHash.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(img_1hash_RadialVarianceHash_create_10(sigma, numOfAngleLine)));
  44. }
  45. public static RadialVarianceHash create(double sigma)
  46. {
  47. return RadialVarianceHash.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(img_1hash_RadialVarianceHash_create_11(sigma)));
  48. }
  49. public static RadialVarianceHash create()
  50. {
  51. return RadialVarianceHash.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(img_1hash_RadialVarianceHash_create_12()));
  52. }
  53. //
  54. // C++: int cv::img_hash::RadialVarianceHash::getNumOfAngleLine()
  55. //
  56. public int getNumOfAngleLine()
  57. {
  58. ThrowIfDisposed();
  59. return img_1hash_RadialVarianceHash_getNumOfAngleLine_10(nativeObj);
  60. }
  61. //
  62. // C++: double cv::img_hash::RadialVarianceHash::getSigma()
  63. //
  64. public double getSigma()
  65. {
  66. ThrowIfDisposed();
  67. return img_1hash_RadialVarianceHash_getSigma_10(nativeObj);
  68. }
  69. //
  70. // C++: void cv::img_hash::RadialVarianceHash::setNumOfAngleLine(int value)
  71. //
  72. public void setNumOfAngleLine(int value)
  73. {
  74. ThrowIfDisposed();
  75. img_1hash_RadialVarianceHash_setNumOfAngleLine_10(nativeObj, value);
  76. }
  77. //
  78. // C++: void cv::img_hash::RadialVarianceHash::setSigma(double value)
  79. //
  80. public void setSigma(double value)
  81. {
  82. ThrowIfDisposed();
  83. img_1hash_RadialVarianceHash_setSigma_10(nativeObj, value);
  84. }
  85. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  86. const string LIBNAME = "__Internal";
  87. #else
  88. const string LIBNAME = "opencvforunity";
  89. #endif
  90. // C++: static Ptr_RadialVarianceHash cv::img_hash::RadialVarianceHash::create(double sigma = 1, int numOfAngleLine = 180)
  91. [DllImport(LIBNAME)]
  92. private static extern IntPtr img_1hash_RadialVarianceHash_create_10(double sigma, int numOfAngleLine);
  93. [DllImport(LIBNAME)]
  94. private static extern IntPtr img_1hash_RadialVarianceHash_create_11(double sigma);
  95. [DllImport(LIBNAME)]
  96. private static extern IntPtr img_1hash_RadialVarianceHash_create_12();
  97. // C++: int cv::img_hash::RadialVarianceHash::getNumOfAngleLine()
  98. [DllImport(LIBNAME)]
  99. private static extern int img_1hash_RadialVarianceHash_getNumOfAngleLine_10(IntPtr nativeObj);
  100. // C++: double cv::img_hash::RadialVarianceHash::getSigma()
  101. [DllImport(LIBNAME)]
  102. private static extern double img_1hash_RadialVarianceHash_getSigma_10(IntPtr nativeObj);
  103. // C++: void cv::img_hash::RadialVarianceHash::setNumOfAngleLine(int value)
  104. [DllImport(LIBNAME)]
  105. private static extern void img_1hash_RadialVarianceHash_setNumOfAngleLine_10(IntPtr nativeObj, int value);
  106. // C++: void cv::img_hash::RadialVarianceHash::setSigma(double value)
  107. [DllImport(LIBNAME)]
  108. private static extern void img_1hash_RadialVarianceHash_setSigma_10(IntPtr nativeObj, double value);
  109. // native support for java finalize()
  110. [DllImport(LIBNAME)]
  111. private static extern void img_1hash_RadialVarianceHash_delete(IntPtr nativeObj);
  112. }
  113. }