Question
How to set up Script Recognition for the checkmark group if the standard recognition does not work well?
Answer
You can switch to the Script recognition on the Recognition tab of the checkmarks group field's properties:
Used FlexiCapture script objects:
https://help.abbyy.com/en-us/flexicapture/12/developer/icheckmarkgroupvalue
https://help.abbyy.com/en-us/flexicapture/12/developer/icheckmarkvalue
https://help.abbyy.com/en-us/flexicapture/12/developer/ipictureobject
https://help.abbyy.com/en-us/flexicapture/12/developer/ipictureobjectsinfo
Here is the code snippet that recognizes the checkmarks based on the BlacknessPercentage property (what part of checkmark area is black):
int threshold = 25; //% of black pixels
for (int i = 0; i < Result.Count; i ++) //we iterate through all single checmark's rects
{
int left = Result[i].Rect.Left - FieldRegion.SurroundingRect.Left;
int top = Result[i].Rect.Top - FieldRegion.SurroundingRect.Top;
int right = Result[i].Rect.Right - FieldRegion.SurroundingRect.Left;
int bottom = Result[i].Rect.Bottom - FieldRegion.SurroundingRect.Top;
//calculate the coordinates of a single checkmark in the whole checkmark group region
IPictureObject oneCheckmark = FieldRegion.Picture.CreateEditableCopy().CutOut("[" + left.ToString() + "," + top.ToString() + "," + right.ToString() + "," + bottom.ToString() + "]");
//cut out a single checkmark area
if (oneCheckmark.AnalyzePageObjects(null).BlacknessPercentage > threshold)
{Result[i].Value = true;}
else
{Result[i].Value = false;}
//compare the % of blackness in the single checkmark area to the threshold
}
The scheme, how the Result[] and FieldRegion are related:
Comments
0 comments
Please sign in to leave a comment.