OpenCV for Unity  2.6.0
Enox Software / Please refer to OpenCV official document ( http://docs.opencv.org/4.9.0/index.html ) for the details of the argument of the method.
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
OpenCVForUnity.DnnModule.TextRecognitionModel Class Reference

This class represents high-level API for text recognition networks. More...

Inheritance diagram for OpenCVForUnity.DnnModule.TextRecognitionModel:
OpenCVForUnity.DnnModule.Model OpenCVForUnity.DisposableOpenCVObject OpenCVForUnity.DisposableObject

Public Member Functions

 TextRecognitionModel (Net network)
 Create Text Recognition model from deep learning network Call setDecodeType() and setVocabulary() after constructor to initialize the decoding method. More...
 
 TextRecognitionModel (string model, string config)
 Create text recognition model from network represented in one of the supported formats Call setDecodeType() and setVocabulary() after constructor to initialize the decoding method. More...
 
 TextRecognitionModel (string model)
 Create text recognition model from network represented in one of the supported formats Call setDecodeType() and setVocabulary() after constructor to initialize the decoding method. More...
 
TextRecognitionModel setDecodeType (string decodeType)
 Set the decoding method of translating the network output into string. More...
 
string getDecodeType ()
 Get the decoding method. More...
 
TextRecognitionModel setDecodeOptsCTCPrefixBeamSearch (int beamSize, int vocPruneSize)
 Set the decoding method options for "CTC-prefix-beam-search" decode usage. More...
 
TextRecognitionModel setDecodeOptsCTCPrefixBeamSearch (int beamSize)
 Set the decoding method options for "CTC-prefix-beam-search" decode usage. More...
 
TextRecognitionModel setVocabulary (List< string > vocabulary)
 Set the vocabulary for recognition. More...
 
List< string > getVocabulary ()
 Get the vocabulary for recognition. More...
 
string recognize (Mat frame)
 Given the input frame, create input blob, run net and return recognition result. More...
 
void recognize (Mat frame, List< Mat > roiRects, List< string > results)
 Given the input frame, create input blob, run net and return recognition result. More...
 
- Public Member Functions inherited from OpenCVForUnity.DnnModule.Model
IntPtr getNativeObjAddr ()
 
 Model (string model, string config)
 Create model from deep learning network represented in one of the supported formats. An order of model and config arguments does not matter. More...
 
 Model (string model)
 Create model from deep learning network represented in one of the supported formats. An order of model and config arguments does not matter. More...
 
 Model (Net network)
 Create model from deep learning network. More...
 
Model setInputSize (Size size)
 Set input size for frame. More...
 
Model setInputSize (int width, int height)
 
Model setInputMean (Scalar mean)
 Set mean value for frame. More...
 
Model setInputScale (Scalar scale)
 Set scalefactor value for frame. More...
 
Model setInputCrop (bool crop)
 Set flag crop for frame. More...
 
Model setInputSwapRB (bool swapRB)
 Set flag swapRB for frame. More...
 
void setInputParams (double scale, Size size, Scalar mean, bool swapRB, bool crop)
 Set preprocessing parameters for frame. More...
 
void setInputParams (double scale, Size size, Scalar mean, bool swapRB)
 Set preprocessing parameters for frame. More...
 
void setInputParams (double scale, Size size, Scalar mean)
 Set preprocessing parameters for frame. More...
 
void setInputParams (double scale, Size size)
 Set preprocessing parameters for frame. More...
 
void setInputParams (double scale)
 Set preprocessing parameters for frame. More...
 
void setInputParams ()
 Set preprocessing parameters for frame. More...
 
void predict (Mat frame, List< Mat > outs)
 Given the input frame, create input blob, run net and return the output blobs. More...
 
Model setPreferableBackend (int backendId)
 
Model setPreferableTarget (int targetId)
 
Model enableWinograd (bool useWinograd)
 
- Public Member Functions inherited from OpenCVForUnity.DisposableObject
void Dispose ()
 
void ThrowIfDisposed ()
 

Static Public Member Functions

static new TextRecognitionModel __fromPtr__ (IntPtr addr)
 
- Static Public Member Functions inherited from OpenCVForUnity.DnnModule.Model
static Model __fromPtr__ (IntPtr addr)
 
- Static Public Member Functions inherited from OpenCVForUnity.DisposableObject
static IntPtr ThrowIfNullIntPtr (IntPtr ptr)
 

Protected Member Functions

override void Dispose (bool disposing)
 
- Protected Member Functions inherited from OpenCVForUnity.DisposableOpenCVObject
 DisposableOpenCVObject ()
 
 DisposableOpenCVObject (IntPtr ptr)
 
 DisposableOpenCVObject (bool isEnabledDispose)
 
 DisposableOpenCVObject (IntPtr ptr, bool isEnabledDispose)
 
- Protected Member Functions inherited from OpenCVForUnity.DisposableObject
 DisposableObject ()
 
 DisposableObject (bool isEnabledDispose)
 

Additional Inherited Members

- Properties inherited from OpenCVForUnity.DisposableObject
bool IsDisposed [get, protected set]
 
bool IsEnabledDispose [get, set]
 

Detailed Description

This class represents high-level API for text recognition networks.

TextRecognitionModel allows to set params for preprocessing input image. TextRecognitionModel creates net from file with trained weights and config, sets preprocessing input, runs forward pass and return recognition result. For TextRecognitionModel, CRNN-CTC is supported.

Constructor & Destructor Documentation

◆ TextRecognitionModel() [1/3]

OpenCVForUnity.DnnModule.TextRecognitionModel.TextRecognitionModel ( Net  network)

Create Text Recognition model from deep learning network Call setDecodeType() and setVocabulary() after constructor to initialize the decoding method.

Parameters
[in]networkNet object

◆ TextRecognitionModel() [2/3]

OpenCVForUnity.DnnModule.TextRecognitionModel.TextRecognitionModel ( string  model,
string  config 
)

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]modelBinary file contains trained weights
[in]configText file contains network configuration

◆ TextRecognitionModel() [3/3]

OpenCVForUnity.DnnModule.TextRecognitionModel.TextRecognitionModel ( string  model)

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]modelBinary file contains trained weights
[in]configText file contains network configuration

Member Function Documentation

◆ __fromPtr__()

static new TextRecognitionModel OpenCVForUnity.DnnModule.TextRecognitionModel.__fromPtr__ ( IntPtr  addr)
static

◆ Dispose()

override void OpenCVForUnity.DnnModule.TextRecognitionModel.Dispose ( bool  disposing)
protectedvirtual

Reimplemented from OpenCVForUnity.DnnModule.Model.

◆ getDecodeType()

string OpenCVForUnity.DnnModule.TextRecognitionModel.getDecodeType ( )

Get the decoding method.

Returns
the decoding method

◆ getVocabulary()

List<string> OpenCVForUnity.DnnModule.TextRecognitionModel.getVocabulary ( )

Get the vocabulary for recognition.

Returns
vocabulary the associated vocabulary

◆ recognize() [1/2]

string OpenCVForUnity.DnnModule.TextRecognitionModel.recognize ( Mat  frame)

Given the input frame, create input blob, run net and return recognition result.

Parameters
[in]frameThe input image
Returns
The text recognition result

◆ recognize() [2/2]

void OpenCVForUnity.DnnModule.TextRecognitionModel.recognize ( Mat  frame,
List< Mat roiRects,
List< string >  results 
)

Given the input frame, create input blob, run net and return recognition result.

Parameters
[in]frameThe input image
[in]roiRectsList of text detection regions of interest (cv::Rect, CV_32SC4). ROIs is be cropped as the network inputs
[out]resultsA set of text recognition results.

◆ setDecodeOptsCTCPrefixBeamSearch() [1/2]

TextRecognitionModel OpenCVForUnity.DnnModule.TextRecognitionModel.setDecodeOptsCTCPrefixBeamSearch ( int  beamSize,
int  vocPruneSize 
)

Set the decoding method options for "CTC-prefix-beam-search" decode usage.

Parameters
[in]beamSizeBeam size for search
[in]vocPruneSizeParameter to optimize big vocabulary search, only take top vocPruneSize tokens in each search step, vocPruneSize <= 0 stands for disable this prune.

◆ setDecodeOptsCTCPrefixBeamSearch() [2/2]

TextRecognitionModel OpenCVForUnity.DnnModule.TextRecognitionModel.setDecodeOptsCTCPrefixBeamSearch ( int  beamSize)

Set the decoding method options for "CTC-prefix-beam-search" decode usage.

Parameters
[in]beamSizeBeam size for search
[in]vocPruneSizeParameter to optimize big vocabulary search, only take top vocPruneSize tokens in each search step, vocPruneSize <= 0 stands for disable this prune.

◆ setDecodeType()

TextRecognitionModel OpenCVForUnity.DnnModule.TextRecognitionModel.setDecodeType ( string  decodeType)

Set the decoding method of translating the network output into string.

Parameters
[in]decodeTypeThe 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 OpenCVForUnity.DnnModule.TextRecognitionModel.setVocabulary ( List< string >  vocabulary)

Set the vocabulary for recognition.

Parameters
[in]vocabularythe associated vocabulary of the network.

The documentation for this class was generated from the following file: