cv::dnn::TextRecognitionModel Class ReferenceDeep Neural Network module Примеры с cv2.imshow требуют сборки OpenCV с GUI. В ноутбуке с headless-версией используйте вывод изображений через Matplotlib.
cv::dnn::TextRecognitionModel Class Reference
This class represents high-level API for text recognition networks.
More...
#include <opencv2/dnn/dnn.hpp>
Collaboration diagram for cv::dnn::TextRecognitionModel:
Public Member Functions ()
The documentation for this class was generated from the following file:
Create Text Recognition model from deep learning network Call setDecodeType() and setVocabulary() after constructor to initialize the decoding method.
Create text recognition model from network represented in one of the supported formats Call setDecodeType() and setVocabulary() after constructor to initialize the decoding method.
Get the vocabulary for recognition.
Given the input frame, create input blob, run net and return recognition result.
Given the input frame, create input blob, run net and return recognition result.
Set the decoding method options for "CTC-prefix-beam-search" decode usage.
Set the decoding method of translating the network output into string.
Set the vocabulary for recognition.
Create model from deep learning network.
Create model from deep learning network represented in one of the supported formats. An order of model and config arguments does not matter.
Given the input frame, create input blob, run net and return the output blobs.
Set mean value for frame.
Set preprocessing parameters for frame.
Set scalefactor value for frame.
Set input size for frame.
Set flag swapRB for frame.
Set output names for frame.
Detailed Description
Constructor & Destructor Documentation
TextRecognitionModel() [1/3]
cv::dnn::TextRecognitionModel::TextRecognitionModel ( )
Python: cv.dnn.TextRecognitionModel( network ) -> <dnn_TextRecognitionModel object> cv.dnn.TextRecognitionModel( model[, config] ) -> <dnn_TextRecognitionModel object>
TextRecognitionModel() [2/3]
cv::dnn::TextRecognitionModel::TextRecognitionModel ( const Net & network )
Python: cv.dnn.TextRecognitionModel( network ) -> <dnn_TextRecognitionModel object> cv.dnn.TextRecognitionModel( model[, config] ) -> <dnn_TextRecognitionModel object>
Create Text Recognition model from deep learning network Call setDecodeType() and setVocabulary() after constructor to initialize the decoding method.
Parameters
TextRecognitionModel() [3/3]
Python: cv.dnn.TextRecognitionModel( network ) -> <dnn_TextRecognitionModel object> cv.dnn.TextRecognitionModel( model[, config] ) -> <dnn_TextRecognitionModel object>
Create text recognition model from network represented in one of the supported formats Call setDecodeType() and setVocabulary() after constructor to initialize the decoding method.
Parameters
[in] model Binary file contains trained weights [in] config Text file contains network configuration
Here is the call graph for this function:
Member Function Documentation
getDecodeType()
const std::string & cv::dnn::TextRecognitionModel::getDecodeType ( ) const
Python: cv.dnn.TextRecognitionModel.getDecodeType( ) -> retval
Get the decoding method.
Returns the decoding method
getVocabulary()
const std::vector< std::string > & cv::dnn::TextRecognitionModel::getVocabulary ( ) const
Python: cv.dnn.TextRecognitionModel.getVocabulary( ) -> retval
Get the vocabulary for recognition.
Returns vocabulary the associated vocabulary
recognize() [1/2]
std::string cv::dnn::TextRecognitionModel::recognize ( InputArray frame ) const
Python: cv.dnn.TextRecognitionModel.recognize( frame ) -> retval cv.dnn.TextRecognitionModel.recognize( frame, roiRects ) -> results
Given the input frame, create input blob, run net and return recognition result.
Parameters
Returns The text recognition result
recognize() [2/2]
Python: cv.dnn.TextRecognitionModel.recognize( frame ) -> retval cv.dnn.TextRecognitionModel.recognize( frame, roiRects ) -> results
Given the input frame, create input blob, run net and return recognition result.
Parameters
[in] frame The input image [in] roiRects List of text detection regions of interest (cv::Rect , CV_32SC4). ROIs is be cropped as the network inputs [out] results A set of text recognition results.
setDecodeOptsCTCPrefixBeamSearch()
TextRecognitionModel & cv::dnn::TextRecognitionModel::setDecodeOptsCTCPrefixBeamSearch ( int beamSize , int vocPruneSize = 0 )
Python: cv.dnn.TextRecognitionModel.setDecodeOptsCTCPrefixBeamSearch( beamSize[, vocPruneSize] ) -> retval
Set the decoding method options for "CTC-prefix-beam-search" decode usage.
Parameters
[in] beamSize Beam size for search [in] vocPruneSize Parameter to optimize big vocabulary search, only take top vocPruneSize tokens in each search step, vocPruneSize <= 0 stands for disable this prune.
setDecodeType()
Python: cv.dnn.TextRecognitionModel.setDecodeType( decodeType ) -> retval
Set the decoding method of translating the network output into string.
Parameters
[in] decodeType The decoding method of translating the network output into string, currently supported type:
"CTC-greedy" greedy decoding for the output of CTC-based methods
"CTC-prefix-beam-search" Prefix beam search decoding for the output of CTC-based methods
setVocabulary()
TextRecognitionModel & cv::dnn::TextRecognitionModel::setVocabulary ( const std::vector< std::string > & vocabulary )
Python: cv.dnn.TextRecognitionModel.setVocabulary( vocabulary ) -> retval
Set the vocabulary for recognition.
Parameters
[in] vocabulary the associated vocabulary of the network.