Back to Aurora Vision Deep Learning website

You are here: Start » Computer Vision » Deep Learning » DL_ReadCharacters_Multiple

DL_ReadCharacters_Multiple


Header: AVLDL.h
Namespace: avl
Module: DL_OCR

Performs optical character recognition using a pretrained deep learning model on multiple regions of interest.

Syntax

C++
C#
 
void avl::DL_ReadCharacters_Multiple
(
	const avl::Image& inImage,
	const atl::Array<avl::Rectangle2D>& inMultiRoi,
	atl::Optional<const avl::CoordinateSystem2D&> inRoiAlignment,
	const avl::ReadCharactersModelId& inModelId,
	const atl::Array<int>& inCharHeights,
	const float inWidthScale,
	const float inCharSpacing,
	atl::Optional<const atl::String&> inCharRange,
	const float inMinScore,
	const float inMinQuality,
	avl::Polarity::Type inPolarization,
	const float inContrastThreshold,
	const bool inCalculateCandidates,
	const bool inRemoveBoundaryCharacters,
	atl::Optional<int> inCanvasWidth,
	atl::Optional<int> inCanvasHeight,
	atl::Array <atl::Array<avl::OcrResult>> & outCharacters,
	atl::Array <atl::Array<atl::Array<avl::OcrCandidate>>> & outCandidates,
	atl::Array <atl::Array<avl::Region>> & outMasks,
	atl::Array<avl::Rectangle2D>& outAlignedRois,
	atl::Array<avl::Image>& diagCanvas
)

Parameters

Name Type Range Default Description
Input value inImage const Image& Input image
Input value inMultiRoi const Array<Rectangle2D>& Limits the areas where recognized characters are located
Input value inRoiAlignment Optional<const CoordinateSystem2D&> NIL
Input value inModelId const ReadCharactersModelId& () Identifier of a Read Characters model
Input value inCharHeights const Array<int>& {35} Average height of characters in pixels for each ROI
Input value inWidthScale const float 0.1 - 10.0 1.0f Scales image width by the given factor
Input value inCharSpacing const float -0.5 - 0.0f Distance between characters denoted as fraction of inCharHeight
Input value inCharRange Optional<const String&> \"A-Z,a-z,0-9,\\\\\\\\,/,-\" Limits the set of wanted characters
Input value inMinScore const float 0.0 - 1.0 0.5f Sets a minimum required score for a character to be returned
Input value inMinQuality const float 0.0 - 1.0 0.0f Specifies the minimum quality threshold a character must meet to be returned.
Input value inPolarization Polarity::Type Any Sets a required polarity for a character to be returned
Input value inContrastThreshold const float -1.0 - 1.0 0.0f Sets a threshold for a contrast of found characters
Input value inCalculateCandidates const bool True If set to true then outCandidates is calculated
Input value inRemoveBoundaryCharacters const bool False If set to true characters that are not entirely contained in the ROI are filtered out
Input value inCanvasWidth Optional<int> 64 - 8192 Maximum width of internal canvas buffer. If not set, dynamic size mode is used, used only on CUDA execution.
Input value inCanvasHeight Optional<int> 64 - 512 64 Maximum height of internal canvas buffer. If not set, dynamic size mode is used, used only on CUDA execution.
Output value outCharacters Array <Array<OcrResult>> &
Output value outCandidates Array <Array<Array<OcrCandidate>>> & Array of the most likely characters. The first element is the character from outCharacters
Output value outMasks Array <Array<Region>> & Masks of found characters (in Extended model). Contains empty regions in case of using model not supporting masks (in Fast and Balanced model).
Output value outAlignedRois Array<Rectangle2D>& Input rois after transformation
Diagnostic input diagCanvas Array<Image>& Internal canvas images used for OCR

Requirements

For input inImage only pixel formats are supported: 1⨯uint8, 3⨯uint8.

Read more about pixel formats in Image documentation.

Errors

List of possible exceptions:

Error type Description
DomainError Empty image in DL_ReadCharacters_Multiple.
DomainError inCharRange cannot be empty string.
DomainError inModelDirectory cannot be empty string.
DomainError Nonpositive dimensions of ROI in DL_ReadCharacters_Multiple
DomainError The number of items in inCharHeights must be equal to the number of items in inRois in DL_ReadCharacters_Multiple.
DomainError Too small ROI in DL_ReadCharacters_Multiple
DomainError Values of inCharHeights in DL_ReadCharacters_Multiple must be at least equal to 8.
DomainError Zero scale in ROI alignment in DL_ReadCharacters_Multiple
DomainError Not supported inImage pixel format in DL_ReadCharacters_Multiple. Supported formats: 1xUInt8, 3xUInt8.