You are here: Start » Machine Vision Guide » Golden Template

Golden Template

Golden Template technique performs a pixel-to-pixel comparison of two images. This technique is especially useful when the object's surface or object's shape is very complex.

Aurora Vision Studio offers three ways of performing the golden template comparison.

  • Comparison based on pixels intensity - it can be achieved using the CompareGoldenTemplate_Intensity. In this method two images are compared pixel-by-pixel and the defect is classified based on a difference between pixels intensity. This technique is especially useful in finding defects like smudges, scratches etc.

    Golden template Defected object Found defects

    Example usage of Golden Template technique using the pixels intensity based comparison.

  • Comparison based on objects edges - this method is very useful when defects may occur on the edge of the object and pixel comparison may fail due to different light reflections or the checking the object surface is not necessary. For matching object's edges use the CompareGoldenTemplate_Edges filter.

    Golden template Defected object Found defects

    Example usage of Golden Template technique using the edges comparison.

  • Second version of the comparison based on objects edges - this method uses more than one image to create the model for the inspection. Due to that it is not vulnerable to pixel-sized errors and displacements. Advanced tips on how to use its parameters are located here: CompareGoldenTemplate2.

How To Use

Golden template is a previously prepared image which is used to compare image from the camera. This robust technique allows us to perform quick comparison inspection but some conditions must be met:

  • stable light conditions,
  • position of the camera and the object must be still,
  • precise object positioning

Most applications use the Template Matching technique for finding objects and then matched rectangle is compared. Golden template image and image to compare must have this same dimensions. To get best results filter CropImageToRectangle should be used. Please notice that filter CropImageToRectangle performs cropping using a real values and it has sub-pixel precision.


Example below shows how to use a basic golden template matching.

Example application performs following operations

  1. Finding object location using the Template Matching technique.
  2. Comparing input image with previously prepared golden template.
Previous: Camera Calibration and World Coordinates Next: Deep Learning