BlockMeanHash.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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.Img_hashModule
  8. {
  9. // C++: class BlockMeanHash
  10. //javadoc: BlockMeanHash
  11. public class BlockMeanHash : ImgHashBase
  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. img_1hash_BlockMeanHash_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal BlockMeanHash (IntPtr addr) : base (addr) { }
  32. // internal usage only
  33. public static new BlockMeanHash __fromPtr__ (IntPtr addr) { return new BlockMeanHash (addr); }
  34. //
  35. // C++: static Ptr_BlockMeanHash cv::img_hash::BlockMeanHash::create(int mode = BLOCK_MEAN_HASH_MODE_0)
  36. //
  37. //javadoc: BlockMeanHash::create(mode)
  38. public static BlockMeanHash create (int mode)
  39. {
  40. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  41. BlockMeanHash retVal = BlockMeanHash.__fromPtr__(img_1hash_BlockMeanHash_create_10(mode));
  42. return retVal;
  43. #else
  44. return null;
  45. #endif
  46. }
  47. //javadoc: BlockMeanHash::create()
  48. public static BlockMeanHash create ()
  49. {
  50. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  51. BlockMeanHash retVal = BlockMeanHash.__fromPtr__(img_1hash_BlockMeanHash_create_11());
  52. return retVal;
  53. #else
  54. return null;
  55. #endif
  56. }
  57. //
  58. // C++: vector_double cv::img_hash::BlockMeanHash::getMean()
  59. //
  60. //javadoc: BlockMeanHash::getMean()
  61. public MatOfDouble getMean ()
  62. {
  63. ThrowIfDisposed ();
  64. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  65. MatOfDouble retVal = MatOfDouble.fromNativeAddr(img_1hash_BlockMeanHash_getMean_10(nativeObj));
  66. return retVal;
  67. #else
  68. return null;
  69. #endif
  70. }
  71. //
  72. // C++: void cv::img_hash::BlockMeanHash::setMode(int mode)
  73. //
  74. //javadoc: BlockMeanHash::setMode(mode)
  75. public void setMode (int mode)
  76. {
  77. ThrowIfDisposed ();
  78. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  79. img_1hash_BlockMeanHash_setMode_10(nativeObj, mode);
  80. return;
  81. #else
  82. return;
  83. #endif
  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_BlockMeanHash cv::img_hash::BlockMeanHash::create(int mode = BLOCK_MEAN_HASH_MODE_0)
  91. [DllImport (LIBNAME)]
  92. private static extern IntPtr img_1hash_BlockMeanHash_create_10 (int mode);
  93. [DllImport (LIBNAME)]
  94. private static extern IntPtr img_1hash_BlockMeanHash_create_11 ();
  95. // C++: vector_double cv::img_hash::BlockMeanHash::getMean()
  96. [DllImport (LIBNAME)]
  97. private static extern IntPtr img_1hash_BlockMeanHash_getMean_10 (IntPtr nativeObj);
  98. // C++: void cv::img_hash::BlockMeanHash::setMode(int mode)
  99. [DllImport (LIBNAME)]
  100. private static extern void img_1hash_BlockMeanHash_setMode_10 (IntPtr nativeObj, int mode);
  101. // native support for java finalize()
  102. [DllImport (LIBNAME)]
  103. private static extern void img_1hash_BlockMeanHash_delete (IntPtr nativeObj);
  104. }
  105. }