Read/Verify Text Configuration

NI Vision Builder

Identify Parts

How to Read/Verify Text

Use the Read/Verify Text step to perform the following operations on an inspection image:

  • Read unknown characters in the image, and/or
  • Verify the quality of known characters in the image.

Follow these instructions to configure the Read/Verify Text step.

Main Tab

  1. In the Step Name control, enter a descriptive name for the step.
  2. Choose one of the following methods to specify the region of interest for the step:
    • Create a new region of interest.
      1. Select Constant from the Region of Interest listbox.
      2. Select a tool from the menu toolbar that matches the type of region of interest you want to specify.
      3. Draw a region of interest on the image.
    • Select a previously defined region of interest from the Region of Interest listbox.

    Vision Builder AI 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 Options tabs. Segmented objects appear blue in the image.

  3. Verify that the Reposition Region of Interest checkbox 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.

  4. If you are using a annulus region of interest, use the Annulus Orientation control to specify whether you want to use the inside edge or outside edge of the region as the baseline for found characters.

Mode Tab

  1. Choose one of the following methods to specify a character set file to use.
    • If you have trained the software for the character set you want to read, click Browse to select a path to the character set file containing that character set. When you have selected the character set file, the path to the file appears in the Character Set Path control.
      Tip  Click Edit Character Set File to launch the NI OCR Training Interface and edit the character set file.
    • If you have not trained the software for the character set you want to read, click New Character Set File to launch the NI OCR Training Interface. Follow the instructions on the training interface to learn characters and/or patterns you want to detect. Refer to the NI OCR Training Interface Help for more information about using the interface.
  2. Choose to either read and verify text in the image, or to only verify text in the image.
    • If the characters within the specified region of interest are unknown, select Read Text to determine the text in the image based on the specified character set and verify the text using the reference characters in the character set.
    • If the text in the image is already known, select Verify Text to verify the characters in the image based on reference characters in the specified character set.
  3. If Verify Text is selected, specify the value of the text you want to verify. Otherwise, proceed to step 7.
    • To manually enter the value of the text to verify, select Constant from the Text to Verify listbox and enter the text in the Value field.
    • To use the value of a previous measurement or variable as the text to verify, select the measurement from the Text to Verify listbox. The current value of the measurement is displayed in the Value field.

Threshold Tab

Configure options in the Threshold tab carefully. If you manually set the threshold values, and Read/Verify Text 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, Read/Verify Text 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 values. 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.

Size Tab

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

Options Tab

Use the Options tab to determine how Read/Verify Text processes the image to detect characters. The Options tab is disabled if Verify Text is selected on the Mode tab.

  1. Select a Read Strategy and Read Resolution.
  2. Select an Acceptance Level value to indicate how closely an object must match a trained character to be a recognized character.
  3. Enter the Substitution Character you want to appear in the string to indicate objects that are not trained and recognized.
  4. Enable the Aspect Ratio Dependant 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.
  5. Complete the following steps to specify a character pattern when you know that the character string to read always has the same pattern. For example, you can specify that you expect the first character to be a letter and the second character to be a digit. Specifying a pattern increases the speed and accuracy of recognition.
    1. Enable the Use Text Pattern control.
    2. Click Specify Pattern to launch the Pattern Setup dialog box.
    3. Click Add to enable the first line of the Pattern Setup dialog box.
    4. Select the type of character you expect the first character in the string to be, and enter that character.
    5. Repeat steps c and d to define the types of characters you expect in the rest of the string.
    6. Click OK to close the Pattern Setup dialog box.

Limits Tab

  1. Set the conditions that determine whether the inspection step passes or fails. The following list describes common OCR applications and describes how to configure the inspection limits to get the desired result.
    • To compare the recognized characters to a constant, enable the Text Equals control and enter a string that the recognized characters must match.
    • To check that the recognized character string contains a specific string, enable the Text Contains control and enter the string.
    • To ensure that the verification scores for the characters are above a certain value, select the Minimum Verification Score checkbox. The verification score ranges from 0 to 1000 and describes how accurately the character in the inspection image matches the corresponding reference character in the specified character set file. If the character set does not contain a reference character, the step returns a value of 0 for the verification score.
    • To ensure that the classification score for the characters is above a certain value, select the Minimum Classification Score checkbox. The classification score ranges from 0 to 1000 and describes how confident the step is that the recognized character belongs to the assigned character class instead of other character classes in the specified character set file. A score of 1000 indicates that a recognized character is an exact match to the assigned character class.