How to set up Script Recognition for the checkmark group


How to set up Script Recognition for the checkmark group if the standard recognition does not work well?


You can switch to the Script recognition on the Recognition tab of the checkmarks group field's properties:


Used FlexiCapture script objects:

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;}
  {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:


Have more questions? Submit a request



Please sign in to leave a comment.