Table of Contents

Class TextDetectorCNN

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

TextDetectorCNN class provides the functionality of text bounding box detection.

public class TextDetectorCNN : TextDetector, IDisposable, ICvPtrHolder
Inheritance
TextDetectorCNN
Implements
Inherited Members

Remarks

This class is representing to find bounding boxes of text words given an input image. This class uses OpenCV dnn module to load pre-trained model described in @cite LiaoSBWL17. The original repository with the modified SSD Caffe version: https://github.com/MhLiao/TextBoxes. Model can be downloaded fromDropBox. Modified.prototxt file with the model description can be found in opencv_contrib/modules/text/samples/textbox.prototxt.

Methods

Create(string, string)

Creates an instance of the TextDetectorCNN class using the provided parameters.

public static TextDetectorCNN Create(string modelArchFilename, string modelWeightsFilename)

Parameters

modelArchFilename string

the relative or absolute path to the prototxt file describing the classifiers architecture.

modelWeightsFilename string

the relative or absolute path to the file containing the pretrained weights of the model in caffe-binary form.

Returns

TextDetectorCNN

Create(string, string, IEnumerable<Size>)

Creates an instance of the TextDetectorCNN class using the provided parameters.

public static TextDetectorCNN Create(string modelArchFilename, string modelWeightsFilename, IEnumerable<Size> detectionSizes)

Parameters

modelArchFilename string

the relative or absolute path to the prototxt file describing the classifiers architecture.

modelWeightsFilename string

the relative or absolute path to the file containing the pretrained weights of the model in caffe-binary form.

detectionSizes IEnumerable<Size>

a list of sizes for multiscale detection. The values[(300,300),(700,500),(700,300),(700,700),(1600,1600)] are recommended in @cite LiaoSBWL17 to achieve the best quality.

Returns

TextDetectorCNN

Detect(InputArray, out Rect[], out float[])

Method that provides a quick and simple interface to detect text inside an image

public override void Detect(InputArray inputImage, out Rect[] bbox, out float[] confidence)

Parameters

inputImage InputArray

an image to process

bbox Rect[]

a vector of Rect that will store the detected word bounding box

confidence float[]

a vector of float that will be updated with the confidence the classifier has for the selected bounding box

DisposeManaged()

Releases managed resources

protected override void DisposeManaged()