Teach Edge Threshold

Teach Edge Threshold

What is Edge Threshold?

Edge threshold is the minimum contrast or intensity change required for the software to recognize a transition as a valid object edge rather than background noise.

The Teach Edge operation uses the current image tool (such as Simple Tool, Arc Tool, Circle Tool, etc.) to set the edge detection threshold for the video/image currently in the Image Window . You must perform a Teach Edge command every time the edge strength on the inspection part changes. Changes made here will affect all future edge detection vision commands.

Note: If edge detection changes are made while an image tool command is being modified, the changes will be applied to the command.  Additionally, pressing the Apply to all selected commands button will apply the current Edge Threshold to all selected Program Operations. 


The Teach Edge command displays a window called the Threshold Graph that looks something like this:

Edge Threshold Parameters

The Threshold Graph displays the edge strength value at each pixel. 

• The width of the graph corresponds to the length of the Image Tool; that is, the number of pixels covered by the Image Tool is mapped into the fixed width of the Threshold Graph.

• The highest spike in the graph is called the Edge Strength - it represents the largest transition in grayscale value within the image area under the Image Tool.

• The blue horizontal line is the Upper Edge Threshold - the minimum transition from black-to-white in grayscale value that signifies an edge.

• The bronze horizontal line is the Lower Edge Threshold - the minimum transition from white-to-black in grayscale value that signifies an edge.

• The green vertical lines represent the detected edges - the transition points under the Image Tool that exceed the upper or lower edge threshold.

• The red vertical line represents the measured edge - the detected edge that satisfies the polarity and threshold requirements. This is the point that is returned when the tool is executed.

• The top half of the graph represents edges found with Black-to-White Polarity. Edges found with this polarity will appear as spikes in the top half of the Threshold Graph.

• The bottom half of the graph represents edges found with White-to-Black Polarity. Edges found with this polarity will appear as spikes in the bottom half of the Threshold Graph.

Set Edge Threshold

Step

Action

1

From the Vision Ribbon Tab Select Vision > Tool Options > Teach Edge


The Teach Edge dialog appears. Here's a sample:


The current image tool is displayed in the Image Window.  The Edge Strength is automatically calculated and displayed in the Edge Strength box.  Adjusting the Zoom slider will magnify the Threshold Graph. This can be useful when the edge strength is small.

NOTE: You can resize the Teach Edge dialog. When resized, the Threshold Graph is automatically scaled to fit in the plot area on the window. This can be useful if there are multiple edges and the dialog is expanded horizontally - the edges will be plotted much wider and farther apart, making them easier to distinguish.

2

Position and rotate the Image Tool so that it crosses the edge to be scanned. Here's an example:



The Threshold Graph updates as the Image Tool moves across the image.  Rotate the Image Tool so that the scan direction arrow points in the appropriate direction for the current Edge Detection Polarity setting.

3

Drag the Upper and Lower Threshold lines up and down to set the Edge Threshold values. The values are displayed in the corresponding Threshold text boxes.

You can also change the Upper and Lower Threshold values by manually entering the values in the corresponding text boxes.

Alternatively, click the Auto Threshold button. The Edge Threshold values are set to one-fourth of the Edge Strength value.

4

Select the appropriate Polarity and Scan Direction settings.

The Threshold Graph will update when these settings are changed to indicate which edges are detected (green) and which point will be returned when the tool is executed (red).

If User Pick polarity is selected, clicking on any of the green edges in the Threshold Graph will choose it as the measured edge and the line will turn red.

5

If the new edge settings need to be applied to a command that has already been created in the program, select the commands you would like to update in the Program Database and click the "Apply to all selected commands" button.

This will apply all settings, including the upper and lower threshold values, polarity, and scan direction, to the selected commands.


Scenarios Where an Edge Cannot Be Detected

  1. Low Contrast (Faint Edge): The material color matches the background too closely. A classic example is a gray metal part sitting on a brushed steel plate or fixture. The intensity jump is too small to breach the threshold.
  2. Blurry or Defocused Edges: If the camera lens is out of focus, or if the part has a rounded/chamfered edge rather than a sharp 90-degree corner, the transition from light to dark spans too many pixels. This flattens the contrast gradient, making the edge invisible to the software.
  3. Severe Lighting Noise & Reflections: Highly reflective (specular) parts like machined metal or polished plastic create bright hot spots (glare) or deep shadows. This blinding light overwrites the actual geometry of the edge.
  4. Surface Contamination & Texture: Dust, oil films, scratches, or heavy surface grain create local contrast changes. If these variations are as strong as the part's actual edge, the system gets confused or filters out the true edge along with the noise.

How to Resolve a Weak Edge

When dealing with a weak edge, you can resolve the issue using optical fixes (best practice) or software adjustments.
TypeMethodHow It Works
OpticalSwitch to BacklightingPlaces the light behind the part, creating a stark black silhouette against a white background. This maximizes contrast and completely eliminates surface reflections.
OpticalUse Low-Angle Ring/Darkfield LightingCasts light nearly parallel to the part surface. It emphasizes height changes (edges) by reflecting light away from the camera everywhere except at the edge.
OpticalAdd a Color FilterUsing a colored light (or lens filter) that matches the part color will make the part look bright white to a monochrome camera, while a contrasting background will look dark.
SoftwareLower the ThresholdForces the software to accept smaller intensity transitions as valid edges.
SoftwareSwitch to Directional Detection (Polarity)Restrict the edge search tool to look only for transitions going from dark-to-light (or vice versa) to ignore unwanted secondary edges.