OCRTesseract.h 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. //
  2. // This file is auto-generated. Please don't modify it!
  3. //
  4. #pragma once
  5. #ifdef __cplusplus
  6. //#import "opencv.hpp"
  7. #import "opencv2/text.hpp"
  8. #import "opencv2/text/ocr.hpp"
  9. #else
  10. #define CV_EXPORTS
  11. #endif
  12. #import <Foundation/Foundation.h>
  13. #import "BaseOCR.h"
  14. #import "Text.h"
  15. @class Mat;
  16. NS_ASSUME_NONNULL_BEGIN
  17. // C++: class OCRTesseract
  18. /**
  19. * OCRTesseract class provides an interface with the tesseract-ocr API (v3.02.02) in C++.
  20. *
  21. * Notice that it is compiled only when tesseract-ocr is correctly installed.
  22. *
  23. * NOTE:
  24. * - (C++) An example of OCRTesseract recognition combined with scene text detection can be found
  25. * at the end_to_end_recognition demo:
  26. * <https://github.com/opencv/opencv_contrib/blob/master/modules/text/samples/end_to_end_recognition.cpp>
  27. * - (C++) Another example of OCRTesseract recognition combined with scene text detection can be
  28. * found at the webcam_demo:
  29. * <https://github.com/opencv/opencv_contrib/blob/master/modules/text/samples/webcam_demo.cpp>
  30. *
  31. * Member of `Text`
  32. */
  33. CV_EXPORTS @interface OCRTesseract : BaseOCR
  34. #ifdef __cplusplus
  35. @property(readonly)cv::Ptr<cv::text::OCRTesseract> nativePtrOCRTesseract;
  36. #endif
  37. #ifdef __cplusplus
  38. - (instancetype)initWithNativePtr:(cv::Ptr<cv::text::OCRTesseract>)nativePtr;
  39. + (instancetype)fromNative:(cv::Ptr<cv::text::OCRTesseract>)nativePtr;
  40. #endif
  41. #pragma mark - Methods
  42. //
  43. // String cv::text::OCRTesseract::run(Mat image, int min_confidence, int component_level = 0)
  44. //
  45. /**
  46. * Recognize text using the tesseract-ocr API.
  47. *
  48. * Takes image on input and returns recognized text in the output_text parameter. Optionally
  49. * provides also the Rects for individual text elements found (e.g. words), and the list of those
  50. * text elements with their confidence values.
  51. *
  52. * @param image Input image CV_8UC1 or CV_8UC3
  53. * text elements found (e.g. words or text lines).
  54. * recognition of individual text elements found (e.g. words or text lines).
  55. * for the recognition of individual text elements found (e.g. words or text lines).
  56. * @param component_level OCR_LEVEL_WORD (by default), or OCR_LEVEL_TEXTLINE.
  57. */
  58. - (NSString*)run:(Mat*)image min_confidence:(int)min_confidence component_level:(int)component_level NS_SWIFT_NAME(run(image:min_confidence:component_level:));
  59. /**
  60. * Recognize text using the tesseract-ocr API.
  61. *
  62. * Takes image on input and returns recognized text in the output_text parameter. Optionally
  63. * provides also the Rects for individual text elements found (e.g. words), and the list of those
  64. * text elements with their confidence values.
  65. *
  66. * @param image Input image CV_8UC1 or CV_8UC3
  67. * text elements found (e.g. words or text lines).
  68. * recognition of individual text elements found (e.g. words or text lines).
  69. * for the recognition of individual text elements found (e.g. words or text lines).
  70. */
  71. - (NSString*)run:(Mat*)image min_confidence:(int)min_confidence NS_SWIFT_NAME(run(image:min_confidence:));
  72. //
  73. // String cv::text::OCRTesseract::run(Mat image, Mat mask, int min_confidence, int component_level = 0)
  74. //
  75. - (NSString*)run:(Mat*)image mask:(Mat*)mask min_confidence:(int)min_confidence component_level:(int)component_level NS_SWIFT_NAME(run(image:mask:min_confidence:component_level:));
  76. - (NSString*)run:(Mat*)image mask:(Mat*)mask min_confidence:(int)min_confidence NS_SWIFT_NAME(run(image:mask:min_confidence:));
  77. //
  78. // void cv::text::OCRTesseract::setWhiteList(String char_whitelist)
  79. //
  80. - (void)setWhiteList:(NSString*)char_whitelist NS_SWIFT_NAME(setWhiteList(char_whitelist:));
  81. //
  82. // static Ptr_OCRTesseract cv::text::OCRTesseract::create(c_string datapath = 0, c_string language = 0, c_string char_whitelist = 0, ocr_engine_mode oem = OEM_DEFAULT, page_seg_mode psmode = PSM_AUTO)
  83. //
  84. /**
  85. * Creates an instance of the OCRTesseract class. Initializes Tesseract.
  86. *
  87. * @param datapath the name of the parent directory of tessdata ended with "/", or NULL to use the
  88. * system's default directory.
  89. * @param language an ISO 639-3 code or NULL will default to "eng".
  90. * @param char_whitelist specifies the list of characters used for recognition. NULL defaults to ""
  91. * (All characters will be used for recognition).
  92. * @param oem tesseract-ocr offers different OCR Engine Modes (OEM), by default
  93. * tesseract::OEM_DEFAULT is used. See the tesseract-ocr API documentation for other possible
  94. * values.
  95. * @param psmode tesseract-ocr offers different Page Segmentation Modes (PSM) tesseract::PSM_AUTO
  96. * (fully automatic layout analysis) is used. See the tesseract-ocr API documentation for other
  97. * possible values.
  98. *
  99. * NOTE: The char_whitelist default is changed after OpenCV 4.7.0/3.19.0 from "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" to "".
  100. */
  101. + (OCRTesseract*)create:(NSString*)datapath language:(NSString*)language char_whitelist:(NSString*)char_whitelist oem:(ocr_engine_mode)oem psmode:(page_seg_mode)psmode NS_SWIFT_NAME(create(datapath:language:char_whitelist:oem:psmode:));
  102. /**
  103. * Creates an instance of the OCRTesseract class. Initializes Tesseract.
  104. *
  105. * @param datapath the name of the parent directory of tessdata ended with "/", or NULL to use the
  106. * system's default directory.
  107. * @param language an ISO 639-3 code or NULL will default to "eng".
  108. * @param char_whitelist specifies the list of characters used for recognition. NULL defaults to ""
  109. * (All characters will be used for recognition).
  110. * @param oem tesseract-ocr offers different OCR Engine Modes (OEM), by default
  111. * tesseract::OEM_DEFAULT is used. See the tesseract-ocr API documentation for other possible
  112. * values.
  113. * (fully automatic layout analysis) is used. See the tesseract-ocr API documentation for other
  114. * possible values.
  115. *
  116. * NOTE: The char_whitelist default is changed after OpenCV 4.7.0/3.19.0 from "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" to "".
  117. */
  118. + (OCRTesseract*)create:(NSString*)datapath language:(NSString*)language char_whitelist:(NSString*)char_whitelist oem:(ocr_engine_mode)oem NS_SWIFT_NAME(create(datapath:language:char_whitelist:oem:));
  119. /**
  120. * Creates an instance of the OCRTesseract class. Initializes Tesseract.
  121. *
  122. * @param datapath the name of the parent directory of tessdata ended with "/", or NULL to use the
  123. * system's default directory.
  124. * @param language an ISO 639-3 code or NULL will default to "eng".
  125. * @param char_whitelist specifies the list of characters used for recognition. NULL defaults to ""
  126. * (All characters will be used for recognition).
  127. * tesseract::OEM_DEFAULT is used. See the tesseract-ocr API documentation for other possible
  128. * values.
  129. * (fully automatic layout analysis) is used. See the tesseract-ocr API documentation for other
  130. * possible values.
  131. *
  132. * NOTE: The char_whitelist default is changed after OpenCV 4.7.0/3.19.0 from "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" to "".
  133. */
  134. + (OCRTesseract*)create:(NSString*)datapath language:(NSString*)language char_whitelist:(NSString*)char_whitelist NS_SWIFT_NAME(create(datapath:language:char_whitelist:));
  135. /**
  136. * Creates an instance of the OCRTesseract class. Initializes Tesseract.
  137. *
  138. * @param datapath the name of the parent directory of tessdata ended with "/", or NULL to use the
  139. * system's default directory.
  140. * @param language an ISO 639-3 code or NULL will default to "eng".
  141. * (All characters will be used for recognition).
  142. * tesseract::OEM_DEFAULT is used. See the tesseract-ocr API documentation for other possible
  143. * values.
  144. * (fully automatic layout analysis) is used. See the tesseract-ocr API documentation for other
  145. * possible values.
  146. *
  147. * NOTE: The char_whitelist default is changed after OpenCV 4.7.0/3.19.0 from "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" to "".
  148. */
  149. + (OCRTesseract*)create:(NSString*)datapath language:(NSString*)language NS_SWIFT_NAME(create(datapath:language:));
  150. /**
  151. * Creates an instance of the OCRTesseract class. Initializes Tesseract.
  152. *
  153. * @param datapath the name of the parent directory of tessdata ended with "/", or NULL to use the
  154. * system's default directory.
  155. * (All characters will be used for recognition).
  156. * tesseract::OEM_DEFAULT is used. See the tesseract-ocr API documentation for other possible
  157. * values.
  158. * (fully automatic layout analysis) is used. See the tesseract-ocr API documentation for other
  159. * possible values.
  160. *
  161. * NOTE: The char_whitelist default is changed after OpenCV 4.7.0/3.19.0 from "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" to "".
  162. */
  163. + (OCRTesseract*)create:(NSString*)datapath NS_SWIFT_NAME(create(datapath:));
  164. /**
  165. * Creates an instance of the OCRTesseract class. Initializes Tesseract.
  166. *
  167. * system's default directory.
  168. * (All characters will be used for recognition).
  169. * tesseract::OEM_DEFAULT is used. See the tesseract-ocr API documentation for other possible
  170. * values.
  171. * (fully automatic layout analysis) is used. See the tesseract-ocr API documentation for other
  172. * possible values.
  173. *
  174. * NOTE: The char_whitelist default is changed after OpenCV 4.7.0/3.19.0 from "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" to "".
  175. */
  176. + (OCRTesseract*)create NS_SWIFT_NAME(create());
  177. @end
  178. NS_ASSUME_NONNULL_END