Automatic Programming of Machine Vision Systems

L. J. de Hass

Abstract

In industrial automation, the manual programming of machine vision systems is often a bottleneck due to the variability of scene conditions and the complexity of geometric modeling. This paper describes a system that automates vision program generation by treating vision as an inverse parsing problem. Using context-free attribute grammars to model objects and a recursive planner to select image primitives, the system generates optimized code that is refined through a trial-and-error testing phase on example images.

Introduction

During the mid-1980s, deploying machine vision on factory floors required significant manual effort. Programmers had to account for object geometry, hardware limitations, and unpredictable environmental factors such as lighting and clutter. Because these "scene conditions" are difficult to model mathematically, the development process often involved tedious manual tuning. This research proposes an automated alternative: a system where users provide high-level geometric models and queries, and the system generates the necessary vision code.

Methodology

The proposed architecture centers on a Planner that synthesizes programs from three primary inputs:

  1. Object Models: Defined using context-free attribute grammars. These models describe objects as hierarchical structures of parts and specify algebraic relationships between their attributes (e.g., position, scale, and distance).
  2. Primitive Library: A collection of low-level image processing functions, such as template matching, capable of identifying basic features.
  3. User Queries: High-level requests for specific information, such as measuring the distance between two features.

The Planner operates recursively using three strategies:

  • Generative Expansion: Decomposing complex objects into constituent parts based on the grammar.
  • Primitive Calling: Mapping library functions to specific variables that can be directly measured.
  • Equation Solving: Utilizing the algebraic relationships within the grammar to derive unknown variables from measured ones.

The resulting programs follow a two-stage execution: Hypothesis Generation, where the system locates the object, and Verification, where predictions are checked against the image to ensure validity. The system was developed and tested using the proprietary Philips PAPS (Picture Acquisition and Processing System).

The "Twodisks" Case Study

The system's logic is best illustrated through the "twodisks" example. In this model, an object is defined as consisting of two disks separated by a vector $D$.

Geometric representation of the 'twodisks' object model, showing the vector D between two disks.

The grammar also includes constraints on the attributes of these disks. For instance, the distance $D$ must be non-zero, and the scales ($s$) of the two disks ($d1$ and $d2$) are typically expected to be equal.

Attribute constraints for the 'twodisks' model, specifying non-zero distance and equal scale.

When a user queries the distance $D$, the planner generates a program that locates both disks using a diskprogram primitive and calculates the vector $D$ by subtracting their coordinates. The system exhibits "lazy" optimization: if the query only requires the size of one disk, the planner omits the steps related to the second disk, maximizing execution speed.

Key Insights

A fundamental contribution of this work is viewing Vision as Inverse Parsing. If an image is a "sentence" generated by a grammar, then computer vision is the process of parsing that sentence back into its structural model. Furthermore, the system automates the "trial and error" cycle common in manual programming. By testing candidate programs against a small set of "teacher-led" example images, the system identifies the most robust code for specific industrial environments without requiring a perfect mathematical model of the scene.

Limitations and Future Work

While effective for rigid industrial parts, the system faces challenges with highly complex or non-linear geometric relationships. The search space for programs can be vast, requiring pruning mechanisms that may occasionally favor "good enough" solutions over the absolute optimum. Future work suggests moving toward more general model-driven systems, though the "off-line planning" approach remains highly efficient for specialized industrial tasks.

Summary updated

BibTeX
@inproceedings{hass1987automatic,
  author = {L. J. de Hass},
  title = {{Automatic Programming of Machine Vision Systems}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {1987},
}
Figure