Quality Magazine logo
search
cart
facebook twitter linkedin youtube
  • Sign In
  • Create Account
  • Sign Out
  • My Account
Quality Magazine logo
  • NEWS
  • PRODUCTS
    • FEATURED PRODUCTS
    • SUBMIT YOUR PRODUCT
  • CHANNELS
    • AUTOMATION
    • MANAGEMENT
    • MEASUREMENT
    • NDT
    • QUALITY 101
    • SOFTWARE
    • TEST & INSPECTION
    • VISION & SENSORS
  • MARKETS
    • AEROSPACE
    • AUTOMOTIVE
    • ENERGY
    • GREEN MANUFACTURING
    • MEDICAL
  • MEDIA
    • A WORD ON QUALITY PUZZLE
    • EBOOK
    • PODCASTS
    • VIDEOS
    • WEBINARS
  • EVENTS
    • EVENT CALENDAR
    • IMTS
  • DIRECTORIES
    • BUYERS GUIDE >
      • Supplier Insights
    • NDT SOURCEBOOK
    • VISION & SENSORS
    • TAKE A TOUR
  • INFOCENTERS
    • Digital Quality Management Systems
    • NEXT GENERATION SPC & QUALITY ANALYTICS
  • AWARDS
    • ROOKIE OF THE YEAR
    • PLANT OF THE YEAR
    • PROFESSIONAL OF THE YEAR
  • MORE
    • Expert Columns
    • NEWSLETTERS
    • QUALITY STORE
    • INDUSTRY LINKS
    • SPONSOR INSIGHTS
  • EMAG
    • eMAGAZINE
    • ARCHIVES
    • CONTACT
    • ADVERTISE
  • SIGN UP!
Test & InspectionVision & Sensors

Change Detection for Machine Vision Applications

Finding the differences between images can lead to improved product quality

By Ruben Uribe
December 10, 2013

We have all read the Sunday newspaper where we were challenged with finding the difference between one image and an almost identical image positioned right next to it. Sounds easy but some are more difficult than others.

Many machine vision systems are faced with a similar challenge but the stakes are much higher. They must find the difference between one image, a “golden template,” and another image, usually a currently captured image. Any differences might indicate a failed and rejected product. The “golden template,” as it is affectionately known, is considered the standard. It is the perfect image that is defect free. From a manufacturer’s point of view, it is the ideal product.  That might be a stretch since there is usually more to a product than what meets the eye, but aesthetics can play an important role in determining the quality of a product. The difference between the golden template and a new image might point out a defect like a missing washer, a missing electronic component or a botched printed page.

Defining the “Golden Template”

As mentioned above, it is the perfect image of the product. Ask anyone who has worked at a manufacturing plant, and they can attest that finding that perfect product might be a challenge in itself. There are always variations from the original design. Some of these variations are subtle and insignificant, but are variations nonetheless. If one were to use the first product off of the production line as the golden template, that first piece might have a variation that would’ve caused it to fail itself. Then using it as the golden template, all subsequent parts without this variation would be considered failures when in fact they might really be good parts.

Another possibility is to sample several parts and develop an averaged image to use as the golden template. The logic behind this tactic is that small, insignificant and subtle variations on each individual part would be diminished in the averaged golden template image.  Sometimes this works and sometimes it exacerbates the problem. The golden template may then be a collection of defects which are being used to compare all subsequent images. Maybe this is not a good idea. Still yet another solution is to use a design graphic of the original product as the golden template. Now we have a solution, right? Unfortunately, the production product rarely is identical to the actual designed product. There also are color, scale and reflective properties that sometimes can’t be considered in the design layout. Also the camera perspective becomes an issue because the graphic has no perspective. It is flat and perfect whereas a camera has angular distortion and is oriented to view the product. Comparing a graphic design to a real captured image usually shows many “changes,” even if the product is identical to the graphic of the product.

Generally, most manufacturers recognize the issues associated with defining the golden template and with some compromise, heartache and soul searching, a golden template can usually be defined. Tolerances are eased, important defects are identified and insignificant variations are ignored. So, let’s assume we have a sufficient golden template. How to compare the new part with the template? There are several methods available, but the most common method involves image subtraction. This is where we subtract the new scanned image from the golden template image. In an ideal situation, the resulting image will be black with only lighter areas where changes/differences occur.

Let’s look at the example images on the previous page the image on the left is the golden template and the image on the middle is the newly scanned image. They look similar but when we subtract the two images, we get an unexpected result on the far right. The red pixels are the changes detected.

It appears that there are a great number of “changes.” How could two images that appear to look so similar give such a big difference? Are these changes real? We have to remember that our brains can ignore certain image qualities that a computer struggles to ignore.

What is really going on?

Differences between the Golden Template and the Sample

Rotation: The middle image is slightly rotated by one degree. If we were able to rotate the image back so that they were in the same polar positions, then the results may look a little better.

Scale: When we analyze the two images we discover that the second image is slightly smaller (two pixels) than the first image. This slight scale variation causes the image subtraction to detect it as a change.

Intensity/Lighting variation: The image on the middle is slightly darker than the image on the left and again this slight variation of intensity will show up as change during an image subtraction.

Alignment: The second image is shifted slightly to the right causing the two images to also show up as change when doing image subtraction.

Lens Distortion: All lenses distort; some are worse than others. If the position of a part shifts within the field of view then the distortion on that portion of the lens is going to be different that the distortion experienced in the original golden template image.

All of these factors, plus some others not mentioned, prevent the image subtraction method from effectively giving the user the true changes of the newly scanned sample.  If we subtract the golden template from itself, the resultant image should be completely black. Each pixel negates itself because there are no differences, yet our subtracted scanned image is anything but black. Even though our eyes and our brains tell us these images were very similar, our impartial and objective computer told us otherwise.

So how do we get our computer to compensate for all of these factors? There is no one magic algorithm capable of compensating for all of these factors, but we can consider a few. The first is a registration algorithm. This algorithm allows us to align the two images.  Imagine the middle image is made of a flexible, transparent material. The material allows us to place the middle image on top of the left golden template image. We can twist it, stretch it and rotate it until the two images lay perfectly superimposed on top of each other. The top image is not completely transparent because it has to have some features to use as a reference to align with the bottom image, otherwise you wouldn’t have any idea where the alignment points are located. These features are the basis for most registration algorithms.  Find the features that are common between the two images, then stretch, twist and expand one of the images until all of those features are aligned. The algorithm transforms the images so that they lay aligned on top of one another. Well, not actually, but figuratively, because in the images buffers are aligned in the computer memory.

So we’re done, right? Wrong. Registration only compensates for the alignment of the two images. If the images have light intensity variations, then these will be detected as change. Normally in most machine vision applications, the lighting will be controlled. The elimination of uncontrolled ambient lighting helps minimize the variation of lighting. Nonetheless, lighting will vary over time: lights degrade, power fluctuates, product color may change, camera and electronics temperature may vary, and lenses are non-uniform across the field of view. All of these play a part in light intensity variation. Also light tends to be brighter in the center of the field of view and gets weaker out on the edges. Many cameras come with flat field correction which can compensate for much of the unevenness within the field of view.

In order to remove light variation from the equation we need to balance the intensity of the two images, or we need to use an algorithm that is indifferent to the light variations. Normalizing the intensity is probably the simplest and quickest technique. This is when you study the grey level statistics of the two images and adjust one to better match the second image. In other words, if the middle image is slightly darker than the golden template, then uniformly brighten the middle image so it better matches the intensity values of the golden template. This works when the intensity values are uniformly different but sometimes the lens and lighting cause uneven intensity values.

The best solution for light variations is to use “light invariant” algorithms. These algorithms are based on features of the two images and will work even if the polarities of the two images are reversed.

Now that we have figured out the registration and considered light intensity variations, let’s compare the sets of images on this page to see if we can successfully determine the differences between them.

In conclusion, there is no magic bullet to solve all change detection challenges. However, registration and change detection algorithms can be customized for specific machine vision applications in order to minimize registration errors and to sense significant changes or defects. Once in place, the benefits of a change detection system can add value to the end user by increasing efficiency and consistency. Many of the algorithms can also be accelerated and optimized by utilizing high speed parallel processors like FPGA, ASICS and GPUs, but we’ll save that for a future article. V&S

Ruben Uribe is president of Imaging Technology Solutions LLC. For more information, call (770) 642-0618, email [email protected] or visit www.imagingtechnology.com

TECH TIPS

There is no magic bullet to solve all change detection challenges, but there are tools that can help.

Registration and change detection algorithms can be customized for specific machine vision applications in order to minimize registration errors and to sense significant changes or defects.

The benefits of a change detection system can add value to the end user by increasing efficiency and consistency.

KEYWORDS: imaging

Share This Story

Looking for a reprint of this article?
From high-res PDFs to custom plaques, order your copy today!

Recommended Content

JOIN TODAY
to unlock your recommendations.

Already have an account? Sign In

  • 2024 Quality Rookie of the Year Justin Wise 1440x750px banner with "Quality Rookie of the Year" logo inset

    Meet the 2024 Quality Rookie of the Year: Justin Wise

    Justin Wise is an exceptional individual who has been...
    Aerospace
    By: Michelle Bangert
  • Man with umbrella and coat stands outside while it rains at night looking at a building.

    Nondestructive Testing: Is there an ethics problem?

    I was a whistleblower who exposed fraudulent activities...
    NDT
    By: Dale Norwood
  • Unraveling Deflategate: Football stadium with closeup of football on field

    Unraveling the Tom Brady Deflategate

    The Deflategate scandal erupted following the 2014 AFC...
    Measurement
    By: Greg Cenker and Henry Zumbrun
Manage My Account
  • eMagazine Subscriptions
  • Newsletters
  • Online Registration
  • Subscription Customer Service
  • Manage My Preferences

More Videos

Sponsored Content

Sponsored Content is a special paid section where industry companies provide high quality, objective, non-commercial content around topics of interest to the Quality audience. All Sponsored Content is supplied by the advertising company and any opinions expressed in this article are those of the author and not necessarily reflect the views of Quality or its parent company, BNP Media. Interested in participating in our Sponsored Content section? Contact your local rep!

close
  • Key Takeaways for Quality Leaders
    Sponsored byComplianceQuest

    Key Takeaways for Quality Leaders from the 2026 Gartner Magic Quadrant™ for QMS

  • This image shows a person seated next to a Bobcat T66 compact track loader.
    Sponsored byPolyWorks by InnovMetric

    Supercharging Digital Gauging at Bobcat North America

  • Dorsey Calibration Lab photo by Tom LaBarbera Picture this Studios
    Sponsored byDorsey Metrology International

    Ensuring Product Quality in a Competitive Manufacturing Landscape

Popular Stories

a titanium diaphragm speaker driver

The One Thing Elon Gets Right Is Designed to Scare You

This image shows a person seated next to a Bobcat T66 compact track loader.

Supercharging Digital Gauging at Bobcat North America

Dorsey Calibration Lab photo by Tom LaBarbera Picture this Studios

Ensuring Product Quality in a Competitive Manufacturing Landscape

2026 Quality Professional of the Year!

Events

June 9, 2026

Future-Proof your Quality Processes with Advanced 3D Optical CMM Technology

Discover how to effortlessly capture complex data, leverage true multi-sensor automation, and ensure continuous operation without creating inspection delays.

June 22, 2026

Automate 2026

Automate is North America's largest robotics and automation event — and the best place to take your ideas from insight to impact.
 
Our show floor features the world’s leading automation solutions, from AI and robotics to motion control, vision systems, and more. Plus, our educational conference is second to none, led by the brightest minds in automation today.
 
Ready to transform the way you work? Take the next step at Automate.
View All Submit An Event

Products

Lean Manufacturing and Service Fundamentals, Applications, and Case Studies

Lean Manufacturing and Service Fundamentals, Applications, and Case Studies

See More Products
Quality Podcast Channel Custom Content

Related Articles

  • Circuit DIST

    Eliminate Distortion in Wide Angle Imaging for Machine Vision Applications

    See More
  • White Light for Machine Vision Applications

    See More
  • How to Choose the Right Lighting for Machine Vision Applications

    See More

Related Products

See More Products
  • Machine Vision and Error Proofing DVD

  • The Process Improvement Handbook: A Blueprint for Managing Change and Increasing Organizational Performance

  • lean manu.jpg

    Lean Manufacturing and Service Fundamentals, Applications, and Case Studies

See More Products

Related Directories

  • Machine Vision Store

    Machine Vision Store has a laser-sharp focus on machine vision imaging. We deliver a select group of components - cameras, lenses, lights, industrial vision PC's - from leading manufacturers known for quality. Components we understand, support and stand behind. Components and consulting services that will power your success.
  • Phoenix Imaging Machine Vision

    Porosity Inspection of machined metal components using 3D image acquisition. High resolution laser-based scanning optimizes Porosity detection. Phoenix-Middle-Man™ software package provides image storage and database, SQL query and visual display of defects. High-Speed Surface Inspection Systems from Keyence, Omron and Phoenix Imaging for the tough ICE, BEV & Battery projects.
×

Stay in the know with Quality’s comprehensive coverage of
the manufacturing and metrology industries.

Newsletters | Website | eMagazine

JOIN TODAY!
  • RESOURCES
    • Advertise
    • Contact Us
    • Directories
    • Manufacturing Division
    • Store
    • Want More
  • SIGN UP TODAY
    • Create Account
    • eMagazine
    • Newsletters
    • Customer Service
    • Manage Preferences
  • SERVICES
    • Marketing Services
    • Market Research
    • Reprints
    • List Rental
    • Survey/Respondent Access
  • STAY CONNECTED
    • LinkedIn
    • Facebook
    • YouTube
    • X (Twitter)
  • PRIVACY
    • PRIVACY POLICY
    • TERMS & CONDITIONS
    • DO NOT SELL MY PERSONAL INFORMATION
    • PRIVACY REQUEST
    • ACCESSIBILITY

Copyright ©2026. All Rights Reserved BNP Media, Inc. and BNP Media II, LLC.

Design, CMS, Hosting & Web Development :: ePublishing