RFFeatureGetter.cs 2.5 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.XimgprocModule
  8. {
  9. // C++: class RFFeatureGetter
  10. //javadoc: RFFeatureGetter
  11. public class RFFeatureGetter : Algorithm
  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. ximgproc_RFFeatureGetter_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal RFFeatureGetter (IntPtr addr) : base (addr) { }
  32. // internal usage only
  33. public static new RFFeatureGetter __fromPtr__ (IntPtr addr) { return new RFFeatureGetter (addr); }
  34. //
  35. // C++: void cv::ximgproc::RFFeatureGetter::getFeatures(Mat src, Mat features, int gnrmRad, int gsmthRad, int shrink, int outNum, int gradNum)
  36. //
  37. //javadoc: RFFeatureGetter::getFeatures(src, features, gnrmRad, gsmthRad, shrink, outNum, gradNum)
  38. public void getFeatures (Mat src, Mat features, int gnrmRad, int gsmthRad, int shrink, int outNum, int gradNum)
  39. {
  40. ThrowIfDisposed ();
  41. if (src != null) src.ThrowIfDisposed ();
  42. if (features != null) features.ThrowIfDisposed ();
  43. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  44. ximgproc_RFFeatureGetter_getFeatures_10(nativeObj, src.nativeObj, features.nativeObj, gnrmRad, gsmthRad, shrink, outNum, gradNum);
  45. return;
  46. #else
  47. return;
  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++: void cv::ximgproc::RFFeatureGetter::getFeatures(Mat src, Mat features, int gnrmRad, int gsmthRad, int shrink, int outNum, int gradNum)
  56. [DllImport (LIBNAME)]
  57. 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);
  58. // native support for java finalize()
  59. [DllImport (LIBNAME)]
  60. private static extern void ximgproc_RFFeatureGetter_delete (IntPtr nativeObj);
  61. }
  62. }