StaticSaliency.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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.SaliencyModule
  8. {
  9. // C++: class StaticSaliency
  10. //javadoc: StaticSaliency
  11. public class StaticSaliency : Saliency
  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. saliency_StaticSaliency_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal StaticSaliency (IntPtr addr) : base (addr) { }
  32. // internal usage only
  33. public static new StaticSaliency __fromPtr__ (IntPtr addr) { return new StaticSaliency (addr); }
  34. //
  35. // C++: bool cv::saliency::StaticSaliency::computeBinaryMap(Mat _saliencyMap, Mat& _binaryMap)
  36. //
  37. //javadoc: StaticSaliency::computeBinaryMap(_saliencyMap, _binaryMap)
  38. public bool computeBinaryMap (Mat _saliencyMap, Mat _binaryMap)
  39. {
  40. ThrowIfDisposed ();
  41. if (_saliencyMap != null) _saliencyMap.ThrowIfDisposed ();
  42. if (_binaryMap != null) _binaryMap.ThrowIfDisposed ();
  43. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  44. bool retVal = saliency_StaticSaliency_computeBinaryMap_10(nativeObj, _saliencyMap.nativeObj, _binaryMap.nativeObj);
  45. return retVal;
  46. #else
  47. return false;
  48. #endif
  49. }
  50. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  51. const string LIBNAME = "__Internal";
  52. #else
  53. const string LIBNAME = "opencvforunity";
  54. #endif
  55. // C++: bool cv::saliency::StaticSaliency::computeBinaryMap(Mat _saliencyMap, Mat& _binaryMap)
  56. [DllImport (LIBNAME)]
  57. private static extern bool saliency_StaticSaliency_computeBinaryMap_10 (IntPtr nativeObj, IntPtr _saliencyMap_nativeObj, IntPtr _binaryMap_nativeObj);
  58. // native support for java finalize()
  59. [DllImport (LIBNAME)]
  60. private static extern void saliency_StaticSaliency_delete (IntPtr nativeObj);
  61. }
  62. }