BlockMeanHash.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. // C++: class BlockMeanHash
  9. //javadoc: BlockMeanHash
  10. public class BlockMeanHash : ImgHashBase {
  11. protected override void Dispose(bool disposing) {
  12. #if (UNITY_ANDROID && !UNITY_EDITOR)
  13. try {
  14. if (disposing) {
  15. }
  16. if (IsEnabledDispose) {
  17. if (nativeObj != IntPtr.Zero)
  18. img_1hash_BlockMeanHash_delete(nativeObj);
  19. nativeObj = IntPtr.Zero;
  20. }
  21. } finally {
  22. base.Dispose(disposing);
  23. }
  24. #else
  25. return;
  26. #endif
  27. }
  28. protected internal BlockMeanHash(IntPtr addr) : base(addr) { }
  29. // internal usage only
  30. public static new BlockMeanHash __fromPtr__(IntPtr addr) { return new BlockMeanHash(addr); }
  31. //
  32. // C++: static Ptr_BlockMeanHash cv::img_hash::BlockMeanHash::create(int mode = BLOCK_MEAN_HASH_MODE_0)
  33. //
  34. //javadoc: BlockMeanHash::create(mode)
  35. public static BlockMeanHash create(int mode) {
  36. #if (UNITY_ANDROID && !UNITY_EDITOR)
  37. BlockMeanHash retVal = BlockMeanHash.__fromPtr__(img_1hash_BlockMeanHash_create_10(mode));
  38. return retVal;
  39. #else
  40. return null;
  41. #endif
  42. }
  43. //javadoc: BlockMeanHash::create()
  44. public static BlockMeanHash create() {
  45. #if (UNITY_ANDROID && !UNITY_EDITOR)
  46. BlockMeanHash retVal = BlockMeanHash.__fromPtr__(img_1hash_BlockMeanHash_create_11());
  47. return retVal;
  48. #else
  49. return null;
  50. #endif
  51. }
  52. //
  53. // C++: vector_double cv::img_hash::BlockMeanHash::getMean()
  54. //
  55. //javadoc: BlockMeanHash::getMean()
  56. public MatOfDouble getMean() {
  57. ThrowIfDisposed();
  58. #if (UNITY_ANDROID && !UNITY_EDITOR)
  59. MatOfDouble retVal = MatOfDouble.fromNativeAddr(img_1hash_BlockMeanHash_getMean_10(nativeObj));
  60. return retVal;
  61. #else
  62. return null;
  63. #endif
  64. }
  65. //
  66. // C++: void cv::img_hash::BlockMeanHash::setMode(int mode)
  67. //
  68. //javadoc: BlockMeanHash::setMode(mode)
  69. public void setMode(int mode) {
  70. ThrowIfDisposed();
  71. #if (UNITY_ANDROID && !UNITY_EDITOR)
  72. img_1hash_BlockMeanHash_setMode_10(nativeObj, mode);
  73. return;
  74. #else
  75. return;
  76. #endif
  77. }
  78. #if (UNITY_ANDROID && !UNITY_EDITOR)
  79. const string LIBNAME = "opencvforunity";
  80. // C++: static Ptr_BlockMeanHash cv::img_hash::BlockMeanHash::create(int mode = BLOCK_MEAN_HASH_MODE_0)
  81. [DllImport(LIBNAME)]
  82. private static extern IntPtr img_1hash_BlockMeanHash_create_10(int mode);
  83. [DllImport(LIBNAME)]
  84. private static extern IntPtr img_1hash_BlockMeanHash_create_11();
  85. // C++: vector_double cv::img_hash::BlockMeanHash::getMean()
  86. [DllImport(LIBNAME)]
  87. private static extern IntPtr img_1hash_BlockMeanHash_getMean_10(IntPtr nativeObj);
  88. // C++: void cv::img_hash::BlockMeanHash::setMode(int mode)
  89. [DllImport(LIBNAME)]
  90. private static extern void img_1hash_BlockMeanHash_setMode_10(IntPtr nativeObj, int mode);
  91. // native support for java finalize()
  92. [DllImport(LIBNAME)]
  93. private static extern void img_1hash_BlockMeanHash_delete(IntPtr nativeObj);
  94. #endif
  95. }
  96. }