CogOCRMaxTuneData AutoCorrect Method Cognex VisionPro

AutoCorrect makes educated guesses at a "correct" tune record by searching for an OCRMax result that matches the character codes contained in the partially correct input record.

The primary input to AutoCorrect() is a tune record which contains an image, a region, and the correct string of character codes. It is important for the inputRecords to already contain the character codes that the user expects the OCRMaxTool to eventually read in order for the AutoCorrect function to work properly.

The output of AutoCorrect() is a set of tune records which now includes the corrected mark and cell rects location of each character.

Namespace: Cognex.VisionPro.OCRMax
Assembly: Cognex.VisionPro.OCRMax (in Cognex.VisionPro.OCRMax.dll) Version: 65.1.0.0
Syntax

public CogOCRMaxTuneRecordCollection AutoCorrect(
	CogOCRMaxTuneRecord inputRecord,
	CogOCRMaxTuneParams tuneParams,
	CogOCRMaxSegmenter segmenter,
	CogOCRMaxClassifierTrainParams classifierTrainParams,
	CogOCRMaxClassifierRunParams classifierRunParams
)

Parameters

inputRecord
Type: Cognex.VisionPro.OCRMax CogOCRMaxTuneRecord
A tune record which contains the image, region, and correct character codes.

Note that the input tune records Mark and Cell Rectangles may not be filled in, or may be incorrect.

tuneParams
Type: Cognex.VisionPro.OCRMax CogOCRMaxTuneParams
A CogOCRMaxTuneParams object which controls the AutoCorrect process.
segmenter
Type: Cognex.VisionPro.OCRMax CogOCRMaxSegmenter
The current CogOCRMaxSegmenter to be used as a hint or starting point for the AutoCorrect process.
classifierTrainParams
Type: Cognex.VisionPro.OCRMax CogOCRMaxClassifierTrainParams
The current CogOCRMaxClassifierTrainParams, this argument is ignored by AutoCorrect.
classifierRunParams
Type: Cognex.VisionPro.OCRMax CogOCRMaxClassifierRunParams
The current CogOCRMaxClassifierRunParams, this argument is ignored by AutoCorrect.

Return Value

Type: CogOCRMaxTuneRecordCollection
A set of corrected tune records which have the mark and cell rects locations of each character filled in or fixed.
Exceptions

ExceptionCondition
ArgumentNullException
  • Thrown if inputRecord is null.
  • Thrown if tuneParams is null.
  • Thrown if segmenter is null.
  • Thrown if classifierTrainParams is null.
  • Thrown if classifierRunParams is null.
CogOCRMaxInvalidTuneRecordException
  • Thrown if the inputRecord has an unallocated image
  • Thrown if inputRecord contains no character codes
  • Thrown if inputRecord character codes contains an unknown character marker
  • Thrown if inputRecord has a mark rect which has an angle or skew greater than 45 degrees relative to the region
Remarks

AutoCorrect() is primarily used during tuning to aid the user in creating "correct" tune records that can be then passed to AutoTune(). In many cases calling AutoCorrect() will be easier than manually constructing the corrected record.

AutoCorrect may use data from other records contained in the tune data, as well as any of the segmenter, classifier, and classifierTrainParams as hints or starting points when when trying to find a correct record.

See Also