AverageHash.cs 1.8 KB

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