Read and Verify Text in Images

NI Vision Assistant

Read and Verify Text in Images

Main Tab

  1. In the Step Name control, enter a descriptive name for the step.
  2. Verify that the Reposition Region of Interest option is enabled if you want to link the region of interest specified in this step to a previously defined coordinate system.

    Link the region of interest to a coordinate system if the position of the object under inspection changes from image to image, and you need to adjust the position of the region of interest to match the new location of the object.

Train Tab

Follow these instructions to compare objects in an image to a trained set of characters and determine if the characters match a given string:

  1. Click Identification»OCR/OCV or click OCR/OCV in the Identification tab of the Processing Functions palette.
  2. Browse to the character set file you want to open, select the file, and click Open.

    If necessary, click New Character Set File to train additional characters in the NI OCR Training Interface.

  3. Draw a region of interest around the characters you want to read.

    Vision Assistant segments objects in the region of interest by drawing character bounding rectangles around the objects according to the current settings in the Threshold, Size, and Read Options tabs.

Threshold Tab

Note  Configure options in the Threshold tab carefully. If you manually set the threshold values, and OCR/OCV cannot detect characters in the region you specified, the training process does not create the character set file correctly. For example, if you select Fixed Range from the Mode control, and you select a Max value that is too low, OCR/OCV cannot correctly detect the characters in the region of interest.
  1. Select a threshold type from the Mode control.

    When you select Linear or Nonlinear, you must set # of Blocks to at least the number of objects in the region of interest. If you selected Fixed Range in Type, use Min and Max or the slider at the bottom of the histogram to determine the threshold value. If you selected Computed, Linear, or Nonlinear in Type, use Characters to indicate the character color in the image. Light on Dark indicates that the image contains light characters on a dark background. Dark on Light indicates that the image contains dark characters on a light background.

  2. Enable the Ignore Objects Touching Region Borders control to ignore objects that touch the border of the region of interest.
  3. In Remove Small Objects (# of Erosions), select the number of erosions to remove small objects from the region of interest. The OCR Training Interface displays segmented objects in blue.

Size Tab

Use the controls to indicate the character size and spacing values required for character recognition. OCR/OCV recognizes only those characters in the region of inspection that meet the criteria in the Size tab.

Read Options

  1. Select a Read Strategy.
  2. Enable the Aspect Ratio Invariant control to read characters regardless of character size. Otherwise, select an Aspect Ratio value to indicate the allowable difference between the training and reading character sizes and height/width ratios.
  3. Enter the Substitution Character you want to appear in the string to indicate objects that are not trained and recognized.
  4. Select an Acceptance Level value to indicate how closely an object must match a trained character to be a recognized character.
  5. Click Specify Pattern if you know that the text to read always has the same pattern. For example, you can specify that the first character should be a letter and the second character should be a digit. Specifying a pattern increases the speed and accuracy of recognition.
  6. Click OK to add this step to the script and close the parameter window.