AverageHash.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 AverageHash
  9. //javadoc: AverageHash
  10. public class AverageHash : 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_AverageHash_delete(nativeObj);
  19. nativeObj = IntPtr.Zero;
  20. }
  21. } finally {
  22. base.Dispose(disposing);
  23. }
  24. #else
  25. return;
  26. #endif
  27. }
  28. protected internal AverageHash(IntPtr addr) : base(addr) { }
  29. // internal usage only
  30. public static new AverageHash __fromPtr__(IntPtr addr) { return new AverageHash(addr); }
  31. //
  32. // C++: static Ptr_AverageHash cv::img_hash::AverageHash::create()
  33. //
  34. //javadoc: AverageHash::create()
  35. public static AverageHash create() {
  36. #if (UNITY_ANDROID && !UNITY_EDITOR)
  37. AverageHash retVal = AverageHash.__fromPtr__(img_1hash_AverageHash_create_10());
  38. return retVal;
  39. #else
  40. return null;
  41. #endif
  42. }
  43. #if (UNITY_ANDROID && !UNITY_EDITOR)
  44. const string LIBNAME = "opencvforunity";
  45. // C++: static Ptr_AverageHash cv::img_hash::AverageHash::create()
  46. [DllImport(LIBNAME)]
  47. private static extern IntPtr img_1hash_AverageHash_create_10();
  48. // native support for java finalize()
  49. [DllImport(LIBNAME)]
  50. private static extern void img_1hash_AverageHash_delete(IntPtr nativeObj);
  51. #endif
  52. }
  53. }