RFFeatureGetter.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using OpenCVForUnity.CoreModule;
  2. using OpenCVForUnity.UtilsModule;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Runtime.InteropServices;
  6. namespace OpenCVForUnity.XimgprocModule
  7. {
  8. // C++: class RFFeatureGetter
  9. /**
  10. *
  11. * Jun 17, 2014
  12. * author Yury Gitman
  13. */
  14. public class RFFeatureGetter : Algorithm
  15. {
  16. protected override void Dispose(bool disposing)
  17. {
  18. try
  19. {
  20. if (disposing)
  21. {
  22. }
  23. if (IsEnabledDispose)
  24. {
  25. if (nativeObj != IntPtr.Zero)
  26. ximgproc_RFFeatureGetter_delete(nativeObj);
  27. nativeObj = IntPtr.Zero;
  28. }
  29. }
  30. finally
  31. {
  32. base.Dispose(disposing);
  33. }
  34. }
  35. protected internal RFFeatureGetter(IntPtr addr) : base(addr) { }
  36. // internal usage only
  37. public static new RFFeatureGetter __fromPtr__(IntPtr addr) { return new RFFeatureGetter(addr); }
  38. //
  39. // C++: void cv::ximgproc::RFFeatureGetter::getFeatures(Mat src, Mat features, int gnrmRad, int gsmthRad, int shrink, int outNum, int gradNum)
  40. //
  41. public void getFeatures(Mat src, Mat features, int gnrmRad, int gsmthRad, int shrink, int outNum, int gradNum)
  42. {
  43. ThrowIfDisposed();
  44. if (src != null) src.ThrowIfDisposed();
  45. if (features != null) features.ThrowIfDisposed();
  46. ximgproc_RFFeatureGetter_getFeatures_10(nativeObj, src.nativeObj, features.nativeObj, gnrmRad, gsmthRad, shrink, outNum, gradNum);
  47. }
  48. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  49. const string LIBNAME = "__Internal";
  50. #else
  51. const string LIBNAME = "opencvforunity";
  52. #endif
  53. // C++: void cv::ximgproc::RFFeatureGetter::getFeatures(Mat src, Mat features, int gnrmRad, int gsmthRad, int shrink, int outNum, int gradNum)
  54. [DllImport(LIBNAME)]
  55. private static extern void ximgproc_RFFeatureGetter_getFeatures_10(IntPtr nativeObj, IntPtr src_nativeObj, IntPtr features_nativeObj, int gnrmRad, int gsmthRad, int shrink, int outNum, int gradNum);
  56. // native support for java finalize()
  57. [DllImport(LIBNAME)]
  58. private static extern void ximgproc_RFFeatureGetter_delete(IntPtr nativeObj);
  59. }
  60. }