NativeMethods_text.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. using System.Diagnostics.Contracts;
  2. using System.Runtime.InteropServices;
  3. #pragma warning disable 1591
  4. #pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments
  5. #pragma warning disable IDE1006 // Naming style
  6. namespace OpenCvSharp.Internal;
  7. static partial class NativeMethods
  8. {
  9. // BaseOCR
  10. /*
  11. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  12. public static extern ExceptionStatus text_BaseOCR_run1(
  13. IntPtr obj,
  14. IntPtr image,
  15. IntPtr outputText,
  16. IntPtr componentRects,
  17. IntPtr componentTexts,
  18. IntPtr componentConfidences,
  19. int componentLevel);
  20. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  21. public static extern ExceptionStatus text_BaseOCR_run2(
  22. IntPtr obj,
  23. IntPtr image,
  24. IntPtr mask,
  25. IntPtr outputText,
  26. IntPtr componentRects,
  27. IntPtr componentTexts,
  28. IntPtr componentConfidences,
  29. int componentLevel);
  30. */
  31. // OCRTesseract
  32. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  33. public static extern ExceptionStatus text_OCRTesseract_run1(
  34. IntPtr obj,
  35. IntPtr image,
  36. IntPtr outputText,
  37. IntPtr componentRects,
  38. IntPtr componentTexts,
  39. IntPtr componentConfidences,
  40. int componentLevel);
  41. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  42. public static extern ExceptionStatus text_OCRTesseract_run2(
  43. IntPtr obj,
  44. IntPtr image,
  45. IntPtr mask,
  46. IntPtr outputText,
  47. IntPtr componentRects,
  48. IntPtr componentTexts,
  49. IntPtr componentConfidences,
  50. int componentLevel);
  51. /*
  52. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  53. public static extern ExceptionStatus text_OCRTesseract_run3(
  54. IntPtr obj,
  55. IntPtr image,
  56. int minConfidence,
  57. int componentLevel,
  58. IntPtr dst);
  59. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  60. public static extern ExceptionStatus text_OCRTesseract_run4(
  61. IntPtr obj,
  62. IntPtr image,
  63. IntPtr mask,
  64. int minConfidence,
  65. int componentLevel,
  66. IntPtr dst);*/
  67. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  68. public static extern ExceptionStatus text_OCRTesseract_setWhiteList(
  69. IntPtr obj,
  70. [MarshalAs(UnmanagedType.LPStr)] string charWhitelist);
  71. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  72. public static extern ExceptionStatus text_OCRTesseract_create(
  73. [MarshalAs(UnmanagedType.LPStr)] string? datapath,
  74. [MarshalAs(UnmanagedType.LPStr)] string? language,
  75. [MarshalAs(UnmanagedType.LPStr)] string? charWhitelist,
  76. int oem,
  77. int psmode,
  78. out IntPtr returnValue);
  79. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  80. public static extern ExceptionStatus text_Ptr_OCRTesseract_delete(IntPtr obj);
  81. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  82. public static extern ExceptionStatus text_OCRTesseract_get(IntPtr obj, out IntPtr returnValue);
  83. // swt_text_detection.hpp
  84. [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
  85. public static extern ExceptionStatus text_detectTextSWT(
  86. IntPtr input, IntPtr result, int darkOnLight, IntPtr draw, IntPtr chainBBs);
  87. }