OCRBeamSearchDecoder.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. @class OCRBeamSearchDecoderClassifierCallback;
  17. NS_ASSUME_NONNULL_BEGIN
  18. // C++: class OCRBeamSearchDecoder
  19. /**
  20. * OCRBeamSearchDecoder class provides an interface for OCR using Beam Search algorithm.
  21. *
  22. * NOTE:
  23. * - (C++) An example on using OCRBeamSearchDecoder recognition combined with scene text detection can
  24. * be found at the demo sample:
  25. * <https://github.com/opencv/opencv_contrib/blob/master/modules/text/samples/word_recognition.cpp>
  26. *
  27. * Member of `Text`
  28. */
  29. CV_EXPORTS @interface OCRBeamSearchDecoder : BaseOCR
  30. #ifdef __cplusplus
  31. @property(readonly)cv::Ptr<cv::text::OCRBeamSearchDecoder> nativePtrOCRBeamSearchDecoder;
  32. #endif
  33. #ifdef __cplusplus
  34. - (instancetype)initWithNativePtr:(cv::Ptr<cv::text::OCRBeamSearchDecoder>)nativePtr;
  35. + (instancetype)fromNative:(cv::Ptr<cv::text::OCRBeamSearchDecoder>)nativePtr;
  36. #endif
  37. #pragma mark - Methods
  38. //
  39. // String cv::text::OCRBeamSearchDecoder::run(Mat image, int min_confidence, int component_level = 0)
  40. //
  41. /**
  42. * Recognize text using Beam Search.
  43. *
  44. * Takes image on input and returns recognized text in the output_text parameter. Optionally
  45. * provides also the Rects for individual text elements found (e.g. words), and the list of those
  46. * text elements with their confidence values.
  47. *
  48. * @param image Input binary image CV_8UC1 with a single text line (or word).
  49. *
  50. *
  51. * text elements found (e.g. words).
  52. *
  53. * recognition of individual text elements found (e.g. words).
  54. *
  55. * for the recognition of individual text elements found (e.g. words).
  56. *
  57. * @param component_level Only OCR_LEVEL_WORD is supported.
  58. */
  59. - (NSString*)run:(Mat*)image min_confidence:(int)min_confidence component_level:(int)component_level NS_SWIFT_NAME(run(image:min_confidence:component_level:));
  60. /**
  61. * Recognize text using Beam Search.
  62. *
  63. * Takes image on input and returns recognized text in the output_text parameter. Optionally
  64. * provides also the Rects for individual text elements found (e.g. words), and the list of those
  65. * text elements with their confidence values.
  66. *
  67. * @param image Input binary image CV_8UC1 with a single text line (or word).
  68. *
  69. *
  70. * text elements found (e.g. words).
  71. *
  72. * recognition of individual text elements found (e.g. words).
  73. *
  74. * for the recognition of individual text elements found (e.g. words).
  75. *
  76. */
  77. - (NSString*)run:(Mat*)image min_confidence:(int)min_confidence NS_SWIFT_NAME(run(image:min_confidence:));
  78. //
  79. // String cv::text::OCRBeamSearchDecoder::run(Mat image, Mat mask, int min_confidence, int component_level = 0)
  80. //
  81. - (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:));
  82. - (NSString*)run:(Mat*)image mask:(Mat*)mask min_confidence:(int)min_confidence NS_SWIFT_NAME(run(image:mask:min_confidence:));
  83. //
  84. // static Ptr_OCRBeamSearchDecoder cv::text::OCRBeamSearchDecoder::create(Ptr_OCRBeamSearchDecoder_ClassifierCallback classifier, string vocabulary, Mat transition_probabilities_table, Mat emission_probabilities_table, decoder_mode mode, int beam_size = 500)
  85. //
  86. /**
  87. * Creates an instance of the OCRBeamSearchDecoder class. Initializes HMMDecoder.
  88. *
  89. * @param classifier The character classifier with built in feature extractor.
  90. *
  91. * @param vocabulary The language vocabulary (chars when ASCII English text). vocabulary.size()
  92. * must be equal to the number of classes of the classifier.
  93. *
  94. * @param transition_probabilities_table Table with transition probabilities between character
  95. * pairs. cols == rows == vocabulary.size().
  96. *
  97. * @param emission_probabilities_table Table with observation emission probabilities. cols ==
  98. * rows == vocabulary.size().
  99. *
  100. * @param mode HMM Decoding algorithm. Only OCR_DECODER_VITERBI is available for the moment
  101. * (<http://en.wikipedia.org/wiki/Viterbi_algorithm>).
  102. *
  103. * @param beam_size Size of the beam in Beam Search algorithm.
  104. */
  105. + (OCRBeamSearchDecoder*)create:(OCRBeamSearchDecoderClassifierCallback*)classifier vocabulary:(NSString*)vocabulary transition_probabilities_table:(Mat*)transition_probabilities_table emission_probabilities_table:(Mat*)emission_probabilities_table mode:(decoder_mode)mode beam_size:(int)beam_size NS_SWIFT_NAME(create(classifier:vocabulary:transition_probabilities_table:emission_probabilities_table:mode:beam_size:));
  106. /**
  107. * Creates an instance of the OCRBeamSearchDecoder class. Initializes HMMDecoder.
  108. *
  109. * @param classifier The character classifier with built in feature extractor.
  110. *
  111. * @param vocabulary The language vocabulary (chars when ASCII English text). vocabulary.size()
  112. * must be equal to the number of classes of the classifier.
  113. *
  114. * @param transition_probabilities_table Table with transition probabilities between character
  115. * pairs. cols == rows == vocabulary.size().
  116. *
  117. * @param emission_probabilities_table Table with observation emission probabilities. cols ==
  118. * rows == vocabulary.size().
  119. *
  120. * @param mode HMM Decoding algorithm. Only OCR_DECODER_VITERBI is available for the moment
  121. * (<http://en.wikipedia.org/wiki/Viterbi_algorithm>).
  122. *
  123. */
  124. + (OCRBeamSearchDecoder*)create:(OCRBeamSearchDecoderClassifierCallback*)classifier vocabulary:(NSString*)vocabulary transition_probabilities_table:(Mat*)transition_probabilities_table emission_probabilities_table:(Mat*)emission_probabilities_table mode:(decoder_mode)mode NS_SWIFT_NAME(create(classifier:vocabulary:transition_probabilities_table:emission_probabilities_table:mode:));
  125. @end
  126. NS_ASSUME_NONNULL_END