Skip to content

TTMSFNCWXOCRHelper

This component is designed to be used in connection with the TTMSFNCWXOCR component. You can use this component to load an image on which you can select multiple parts of an image to have OCR performed with the TTMSFNCWXOCR component on the selected text. The component will also show feedback about which words might not be correct. It will highlight these words with a color indicating the confidence of the OCR process. You can set 3 levels of confidence for this and three colors for these confidence levels.

Getting started

Simply dropping this component on the form and linking a TTMSFNCWXOCR component in the object is enough to get started. You can then start drawing rectangles. And start the OCR process using the StartOCR method. You can also set the AutoStart property on true. This means that the OCR Process automatically starts when you draw a rectangle on the component. All finished processes are stored in the SelectionResults collection. This object contains the OCRResult, the Bitmap, the drawn Rectangle, and the ID of the object.

TTMSFNCWXOCRHelper

Feedback

This component lets you set limits at which the component will highlight the uncertain words. When setting the LowConfidence property, all words which have a confidence lower than this will be highlighted. The same happens for the ModerateConfidence and ReasonableConfidence. You can disable these limits by setting the value to 0 or lower

Properties

Property name Description
AutoStart Setting this property to true, starts the OCR Process whenever you draw a rectangle in the component
EnableSelection Setting this to false, disables the drawing of rectangles.
EnableFeedback Setting this to false, disables showing feedback of the process
OCR Property that lets you link a TTMSFNCWXOCR component. This is required to use the component to start the OCR Process
Bitmap Property That lets you load an image in the component
LowConfidence Set the bounds to highlight the words which have a confidence lower than this number.
ModerateConfidence Set the bounds to highlight the words which have a confidence lower than this number
ReasonableConfidence Set the bounds to highlight the words which have a confidence lower then this number
Appearance Set the different colours for feedback and selecting rectangles on the component.

Methods

StartFullImageOCR

This method lets you start an OCR process for the whole Image.

StartOCR

This method starts all OCR processes which aren’t already in progress. If there aren’t any processes available, it will start a full image OCR Process

SaveToTemplate

This method returns a list of all drawn rectangles on the form. This list contains TTMSFNCWXOCRHelperRectangle objects. These objects contain the coordinates of the drawn rectangles.

SaveTemplateToJSON

This method returns a JSON string of the drawn template.

LoadTemplate

This method will load a template in the component. You can start the process for this template using the StartOCR method. If you want to re-use the template you will need to reload the template like this before starting the OCR process.

TMSFNCWXOCRHelper1.LoadTemplateFromJSON(JSONString);
TMSFNCWXOCRHelper1.StartOCR;

LoadTemplateFromJSON

Use this method to load a template from a JSON string. This JSON needs to use this template:

[
 {
 "Bottom": 803.559265136719,
 "DPIScale": 1.5,
 "Left": 11.9266719818115,
 "Right": 2319.73681640625,
 "Top": 190.826690673828
 },
 {
 "Bottom": 1738.31176757813,
 "DPIScale": 1.5,
 "Left": 41.743335723877,
 "Right": 2295.88330078125,
 "Top": 977.986755371094
 },
 {
 "Bottom": 2489.69189453125,
 "DPIScale": 1.5,
 "Left": 35.7799987792969,
 "Right": 1923.17492675781,
 "Top": 1854.59692382813
 }
]

ClearNonProcessSelections

This method will delete all Rectangles which are not in progress or are not already finished.

ClearAll

This method will delete all Rectangles. Please note that Rectangles which are in progress will be deleted but the OCR process will continue. The component will just skip over these results.

ResetOCR

This method will Terminate all workers and reinitialize them. This will force stop everything. This will also delete all rectangles and clear the results.

CheckRectanglesAvailableForOCR

This method checks if there are any rectangles that still needs to be processed and don’t have an OCR result, returns true if there are.

TTMSFNCWXOCRHelperSelectionResult

Property name Description
ID The id of the OCR Process, is automatically assigned
Bitmap The part of the image that is used for the OCR.
SelectionDPIScale Used to draw the rectangles correctly when showing it on the image. This property is set when you draw a rectangle.
FeedbackDPIScale Used to show the feedback correctly. This property is set when you start the OCR Process.
OCRResult The Result that returns from the TTMSFNCWXOCR component.
InProgress Boolean to check if this entry has already been started.
Rectangle This object of type TRectF contains the drawn rectangle.

TTMSFNCWXOCRHelperRectangle

This object is used to load and save to templates. This contains the data needed to redraw a rectangle. This contains the top, left, right, bottom and DPI scale of the drawn rectangl