OCRBeamSearchDecoder_ClassifierCallback.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #if !UNITY_WSA_10_0
  2. using OpenCVForUnity.CoreModule;
  3. using OpenCVForUnity.UtilsModule;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Runtime.InteropServices;
  7. namespace OpenCVForUnity.TextModule
  8. {
  9. // C++: class ClassifierCallback
  10. /**
  11. * Callback with the character classifier is made a class.
  12. *
  13. * This way it hides the feature extractor and the classifier itself, so developers can write
  14. * their own OCR code.
  15. *
  16. * The default character classifier and feature extractor can be loaded using the utility function
  17. * loadOCRBeamSearchClassifierCNN with all its parameters provided in
  18. * <https://github.com/opencv/opencv_contrib/blob/master/modules/text/samples/OCRBeamSearch_CNN_model_data.xml.gz>.
  19. */
  20. public class OCRBeamSearchDecoder_ClassifierCallback : DisposableOpenCVObject
  21. {
  22. protected override void Dispose(bool disposing)
  23. {
  24. try
  25. {
  26. if (disposing)
  27. {
  28. }
  29. if (IsEnabledDispose)
  30. {
  31. if (nativeObj != IntPtr.Zero)
  32. text_OCRBeamSearchDecoder_1ClassifierCallback_delete(nativeObj);
  33. nativeObj = IntPtr.Zero;
  34. }
  35. }
  36. finally
  37. {
  38. base.Dispose(disposing);
  39. }
  40. }
  41. protected internal OCRBeamSearchDecoder_ClassifierCallback(IntPtr addr) : base(addr) { }
  42. public IntPtr getNativeObjAddr() { return nativeObj; }
  43. // internal usage only
  44. public static OCRBeamSearchDecoder_ClassifierCallback __fromPtr__(IntPtr addr) { return new OCRBeamSearchDecoder_ClassifierCallback(addr); }
  45. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  46. const string LIBNAME = "__Internal";
  47. #else
  48. const string LIBNAME = "opencvforunity";
  49. #endif
  50. // native support for java finalize()
  51. [DllImport(LIBNAME)]
  52. private static extern void text_OCRBeamSearchDecoder_1ClassifierCallback_delete(IntPtr nativeObj);
  53. }
  54. }
  55. #endif