Polarity Property

Applies To
Vision Objects: ArcInspector, ArcFinder, Blob, BoxFinder, Contour, CornerFinder, DefectFinder, Edge, ImageOp, LineFinder, LineInspector, OCR

Description
For Blob, ImageOp, OCR objects, Polarity defines the differentiation between objects and background.

The Polarity property defines the edge direction for Edge, LineFinder, ArcFinder, LineInspector, ArcInspector, BoxFinder and CornerFinder objects.

When using DefectFinder, the Polarity property defines the polarity of defects detected.

Usage

VGet  Sequence.Object.Polarity, var
VSet  Sequence.Object.Polarity, value
Sequence
Name of a sequence or string variable containing a sequence name.
Object
Name of an object or string variable containing an object name. The object must exist in the specified sequence.
var
Integer variable that will contain the value of the property.
value
Integer value or expression for the new value of the property.

Values

  • Edge:

    • 1 - LightToDark
      • Vision Constant: VISION_POLARITY_DARK
      • Searching for an Edge transition from light to dark
    • 2 - DarkToLight
      • Vision Constant: VISION_POLARITY_LIGHT
      • Searching for an Edge transition from dark to light
    • 3 - Both
      • Vision Constant: VISION_POLARITY_BOTH
      • Detects both an Edge transition from light to dark, and an Edge transition from dark to light
  • Blob:

    • 1 - DarkOnLight
      • Vision Constant: VISION_POLARITY_DARK
      • Find a dark blob on a light background
    • 2 - LightOnDark
      • Vision Constant: VISION_POLARITY_LIGHT
      • Find a light blob on a dark background
  • ImageOp:

    • 1 - DarkOnLight
      • Vision Constant: VISION_POLARITY_DARK
      • The operation will be performed on dark objects.
    • 2 - LightOnDark
      • Vision Constant: VISION_POLARITY_LIGHT
      • The operation will be performed on light objects.
  • LineFinder:

    • 1 - LightToDark
      • Vision Constant: VISION_POLARITY_DARK
      • Searching for an Edge transition from light to dark
    • 2 - DarkToLight
      • Vision Constant: VISION_POLARITY_LIGHT
      • Searching for an Edge transition from dark to light
    • 3 - Both
      • Vision Constant: VISION_POLARITY_BOTH
      • Detects both an Edge transition from light to dark, and an Edge transition from dark to light
  • ArcFinder:

    • 1 - LightToDark
      • Vision Constant: VISION_POLARITY_DARK
      • Searching for an Edge transition from light to dark
    • 2 - DarkToLight
      • Vision Constant: VISION_POLARITY_LIGHT
      • Searching for an Edge transition from dark to light
    • 3 - Both
      • Vision Constant: VISION_POLARITY_BOTH
      • Detects both an Edge transition from light to dark, and an Edge transition from dark to light
  • LineInspector:

    • 1 - LightToDark
      • Vision Constant: VISION_POLARITY_DARK
      • Searching for an Edge transition from light to dark
    • 2 - DarkToLight
      • Vision Constant: VISION_POLARITY_LIGHT
      • Searching for an Edge transition from dark to light
    • 3 - Both
      • Vision Constant: VISION_POLARITY_BOTH
      • Detects both an Edge transition from light to dark, and an Edge transition from dark to light
  • ArcInspector:

    • 1 - LightToDark
      • Vision Constant: VISION_POLARITY_DARK
      • Searching for an Edge transition from light to dark
    • 2 - DarkToLight
      • Vision Constant: VISION_POLARITY_LIGHT
      • Searching for an Edge transition from dark to light
    • 3 - Both
      • Vision Constant: VISION_POLARITY_BOTH
      • Detects both an Edge transition from light to dark, and an Edge transition from dark to light
  • OCR:

    • 1 - DarkOnLight
      • Vision Constant: VISION_POLARITY_DARK
      • Find dark characters on a light background
    • 2 - LightOnDark
      • Vision Constant: VISION_POLARITY_LIGHT
      • Find light characters on a dark background
  • BoxFinder:

    • 1 - LightToDark
      • Vision Constant: VISION_POLARITY_DARK
      • Searching for an Edge transition from light to dark
    • 2 - DarkToLight
      • Vision Constant: VISION_POLARITY_LIGHT
      • Searching for an Edge transition from dark to light
    • 3 - Both
      • Vision Constant: VISION_POLARITY_BOTH
      • Detects both an Edge transition from light to dark, and an Edge transition from dark to light
  • CornerFinder:

    • 1 - LightToDark
    • Vision Constant: VISION_POLARITY_DARK
    • Searching for an Edge transition from light to dark
    • 2 - DarkToLight
      • Vision Constant: VISION_POLARITY_LIGHT
      • Searching for an Edge transition from dark to light
    • 3 - Both
      • Vision Constant: VISION_POLARITY_BOTH
      • Detects both an Edge transition from light to dark, and an Edge transition from dark to light
  • Contour (Blob mode):

    • 1 - DarkOnLight
      • Vision Constant: VISION_POLARITY_DARK
      • Detects a dark Blob on a light background.
    • 2 - LightOnDark
      • Vision Constant: VISION_POLARITY_LIGHT
      • Detects a light Blob on a dark background.
  • Contour (Line mode, Arc mode):

    • 1 - LightToDark
      • Vision Constant: VISION_POLARITY_DARK
      • Searching for an Edge transition from light to dark
    • 2 - DarkToLight
      • Vision Constant: VISION_POLARITY_LIGHT
      • Searching for an Edge transition from dark to light

The default setting for the abovementioned objects: 1

  • DefectFinder:
    • 1 - DarkOnLight
      • Vision Constant: VISION_POLARITY_DARK
      • Detects a dark defect on a light background.
    • 2 - LightOnDark
      • Vision Constant: VISION_POLARITY_LIGHT
      • Detects a light defect on a dark background.
    • 3 - Both
      • Vision constant: VISION_POLARITY_BOTH
      • Detects both dark defects on light backgrounds, and light defects on dark backgrounds.

Default setting for DefectFinder: 3

Remarks
The Polarity property is important for both the Edge and Blob objects because it defines one of the core parameters for each.

When using the Edge object, the Polarity defines the edge transition along the direction of the edge search.

When using the Blob object, the Polarity is critical. The Vision System must be told whether to look for light objects on a dark background or dark objects on a light background. Without the proper setting for the Polarity property, the Blob object will return strange results. Keep in mind that if a Blob object can find a dark object on a light background it can also find a light object on a dark background.

The ThresholdHigh property and ThresholdLow property will also have an impact on the Blob object’s ability to find blobs. Please refer to ThresholdHigh Property and ThresholdLow Property for more information.
ThresholdHigh Property
ThresholdLow Property

When using the Contour object, meaning of the Polarity differs depending on the settings of ContourMode.

  • When ContourMode is Blob: As with Polarity of Blob object, define the differentiation between objects and background.
  • When ContourMode is Line or Arc: As with Polarity of Edge tool, define the edge direction.

See Also
Blob Object, Contour Object, DefectFinder Object, Direction Property, Edge Object, ImageOp Object, LineFinder Object, ArcFinder Object, LineInspector Object, ArcInspector Object, OCR Object, BoxFinder Object, CornerFinder Object, ThresholdLow Property, ThresholdHigh Property