Skip to content

Commit ae4d5d3

Browse files
committed
Merge pull request #2748 from alalek:text_drop_ambiguous_api
2 parents ddafc73 + 52f5f05 commit ae4d5d3

2 files changed

Lines changed: 12 additions & 28 deletions

File tree

modules/text/include/opencv2/text/ocr.hpp

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -474,40 +474,34 @@ class CV_EXPORTS_W OCRBeamSearchDecoder : public BaseOCR
474474
475475
@param beam_size Size of the beam in Beam Search algorithm.
476476
*/
477-
static Ptr<OCRBeamSearchDecoder> create(const Ptr<OCRBeamSearchDecoder::ClassifierCallback> classifier,// The character classifier with built in feature extractor
477+
static CV_WRAP
478+
Ptr<OCRBeamSearchDecoder> create(const Ptr<OCRBeamSearchDecoder::ClassifierCallback> classifier,// The character classifier with built in feature extractor
478479
const std::string& vocabulary, // The language vocabulary (chars when ASCII English text)
479480
// size() must be equal to the number of classes
480481
InputArray transition_probabilities_table, // Table with transition probabilities between character pairs
481482
// cols == rows == vocabulary.size()
482483
InputArray emission_probabilities_table, // Table with observation emission probabilities
483484
// cols == rows == vocabulary.size()
484-
decoder_mode mode = OCR_DECODER_VITERBI, // HMM Decoding algorithm (only Viterbi for the moment)
485-
int beam_size = 500); // Size of the beam in Beam Search algorithm
486-
487-
CV_WRAP static Ptr<OCRBeamSearchDecoder> create(const Ptr<OCRBeamSearchDecoder::ClassifierCallback> classifier, // The character classifier with built in feature extractor
488-
const String& vocabulary, // The language vocabulary (chars when ASCII English text)
489-
// size() must be equal to the number of classes
490-
InputArray transition_probabilities_table, // Table with transition probabilities between character pairs
491-
// cols == rows == vocabulary.size()
492-
InputArray emission_probabilities_table, // Table with observation emission probabilities
493-
// cols == rows == vocabulary.size()
494-
int mode = OCR_DECODER_VITERBI, // HMM Decoding algorithm (only Viterbi for the moment)
495-
int beam_size = 500); // Size of the beam in Beam Search algorithm
485+
text::decoder_mode mode = OCR_DECODER_VITERBI, // HMM Decoding algorithm (only Viterbi for the moment)
486+
int beam_size = 500 // Size of the beam in Beam Search algorithm
487+
);
496488

497489
/** @brief Creates an instance of the OCRBeamSearchDecoder class. Initializes HMMDecoder from the specified path.
498490
499491
@overload
500492
501493
*/
502-
CV_WRAP static Ptr<OCRBeamSearchDecoder> create(const String& filename, // The character classifier file
503-
const String& vocabulary, // The language vocabulary (chars when ASCII English text)
494+
static //CV_WRAP FIXIT bug in handling of Java overloads
495+
Ptr<OCRBeamSearchDecoder> create(const String& filename, // The character classifier file
496+
const String& vocabulary, // The language vocabulary (chars when ASCII English text)
504497
// size() must be equal to the number of classes
505498
InputArray transition_probabilities_table, // Table with transition probabilities between character pairs
506499
// cols == rows == vocabulary.size()
507500
InputArray emission_probabilities_table, // Table with observation emission probabilities
508501
// cols == rows == vocabulary.size()
509-
int mode = OCR_DECODER_VITERBI, // HMM Decoding algorithm (only Viterbi for the moment)
510-
int beam_size = 500);
502+
text::decoder_mode mode = OCR_DECODER_VITERBI, // HMM Decoding algorithm (only Viterbi for the moment)
503+
int beam_size = 500 // Size of the beam in Beam Search algorithm
504+
);
511505
protected:
512506

513507
Ptr<OCRBeamSearchDecoder::ClassifierCallback> classifier;

modules/text/src/ocr_beamsearch_decoder.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -499,21 +499,11 @@ Ptr<OCRBeamSearchDecoder> OCRBeamSearchDecoder::create( Ptr<OCRBeamSearchDecoder
499499
return makePtr<OCRBeamSearchDecoderImpl>(_classifier, _vocabulary, transition_p, emission_p, _mode, _beam_size);
500500
}
501501

502-
Ptr<OCRBeamSearchDecoder> OCRBeamSearchDecoder::create(Ptr<OCRBeamSearchDecoder::ClassifierCallback> _classifier,
503-
const String& _vocabulary,
504-
InputArray transition_p,
505-
InputArray emission_p,
506-
int _mode,
507-
int _beam_size)
508-
{
509-
return makePtr<OCRBeamSearchDecoderImpl>(_classifier, _vocabulary, transition_p, emission_p, (decoder_mode)_mode, _beam_size);
510-
}
511-
512502
Ptr<OCRBeamSearchDecoder> OCRBeamSearchDecoder::create(const String& _filename,
513503
const String& _vocabulary,
514504
InputArray transition_p,
515505
InputArray emission_p,
516-
int _mode,
506+
decoder_mode _mode,
517507
int _beam_size)
518508
{
519509
return makePtr<OCRBeamSearchDecoderImpl>(loadOCRBeamSearchClassifierCNN(_filename), _vocabulary, transition_p, emission_p, (decoder_mode)_mode, _beam_size);

0 commit comments

Comments
 (0)