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
    • EBOOKS
    • 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

Detecting Cracks and Scratches

Machine vision aids in resolving surface flaws.

By Ben Dawson
December 10, 2013

Detecting product surface flaws—such as discolorations, burns, cracks, and scratches—is a difficult task for human or machine vision. These defects can have random shapes and low contrast, and are often obscured by the product’s natural surface texture or pattern. Detecting these defects with machine vision requires knowing what the defects can look like, careful attention to lighting, camera resolution and part presentation, and sophisticated machine vision algorithms.

Here we discuss cracks and scratches, which have rapid intensity changes that produce high spatial frequencies.

Understand the Task

Knowing how these defects occur gives you some ideas of how the defects will appear in the image. For example, a powdered metal (sintered) part might crack only where the material is thin. This “prior knowledge” can improve flaw detection reliability by limiting the machine vision analysis to areas, structures, and directions where flaws occur.

How is the inspection currently done? If it is done by machine vision, what are the current system’s inadequacies? When machine vision is replacing human inspection, ask the inspectors how they do the task and watch them do it. For example, to detect scratches on smooth plastic, a human inspector might turn the part until the scratch “lights up.”

We detect surface flaws by knowing, intuitively and by training, what these defects look like. For example, scratches often appear as a sequence of straight or gently curved line segments that we subconsciously connect into a line, using our “gestalt” abilities. For machine vision, these abilities must be approximated by vision algorithms.

On difficult inspection tasks, human inspectors’ decisions might disagree—is that a scratch or just some brighter points on the part that happen to line up? This is a warning that reliable flaw detection might not be possible. If the defects are clear and what constitutes a defect is well specified, then machine vision can give more consistent decisions than human vision.

Lighting is especially critical in surface flaw detection because these defects typically have low contrast that proper lighting can amplify. For defects that raise the height of a flat surface, try low angle illumination to “light up” the raised area’s edges. For defects that are flat, or when looking for defects on a curved surface, try diffuse light. As you might know, lighting is somewhat of an art. Ask your lighting vendor or vision integrator for help.

The camera and lens must image at three pixels or more across a crack or scratch. Sometimes multiple cameras or stepping the part are needed to inspect the entire surface of the part with the required resolution. Because we are looking for small defects, it is important that the part surface stay in sharp focus. This can be a challenge when the part surface is curved.

Shading Correction

With clear images of good and defective parts, you are ready to try various machine vision algorithms. Software that includes such algorithms makes it easy to try different solutions and is useful for detecting cracks and scratches.

If the intensity of the scratch or crack is well above or below the part’s natural texture, the detection task seems easy: Apply intensity thresholds to show only the pixels from the scratch or crack, and the count of these pixels is your defect signal.

However, pixel values outside the thresholds might be due to non-uniform illumination, rather than a scratch or crack. Shading correction removes variations in illumination, and so improves crack and scratch detection. Shading correction is typically done by spatial-frequency filtering or by dividing the input image by a reference image.

A spatial high-pass filter amplifies high spatial frequency cracks and scratches and removes low frequency changes due to variations in lighting intensity. This filter can crack and scratch detection. Unfortunately it also amplifies the part’s surface texture, giving a noisy image that might make scratch or crack detection difficult.

Instead of amplifying high spatial frequencies, we can subtract low spatial frequencies. First make a low-pass (blurred) image from the input image by averaging pixel intensities around each pixel. These local averages approximate the slowly-changing light intensity. Next, subtract the low-passed image from the input image, leaving high spatial frequency changes—scratches and cracks—against a nearly flat intensity background.

A reference image is created by temporally averaging a sequence of images without the part in place. The reference image shows the illumination distribution. Subsequent input images are divided by the reference image to remove the effects of illumination. Because image intensity is the product of the illumination and the part’s reflectance or transmission, pixel-by-pixel division by the reference image cancels the illumination factor leaving only the part’s reflectance or transmission. This method is commonly used in microscopy but less so on production lines.

Golden Reference Methods

Most parts have reflectance or transmission variations that can obscure scratches and cracks. We can extend the reference image idea by averaging precisely aligned images of known good parts, instead of empty images, to produce a golden reference image. The ensemble variance gives an estimate of the natural or acceptable variation at each point on the part.

This golden reference is subtracted from or divides input part images to remove both lighting variation and part reflectance or transmission variations. The variance measure is used to set detection thresholds at each point in the image. This method works well when the part intensity structure is very closely controlled, for example with semiconductors. The golden reference image and the part input image must also be precisely aligned in position, rotation, and scale.

Repetitive Pattern Removal by Matched Filters

Golden reference methods can sometimes remove repetitive part patterns, such as meshes or grids. However, golden methods give false alarms if the parts are not closely controlled in structure and reflectivity or transmission. In these cases, a matched filter might give better results.

The basic idea is to build a filter that matches the spatial frequency components of the part’s repetitive pattern, and then apply that filter to filter out the pattern, leaving the surface flaws mostly intact—optimizes the signal to noise ratio for the surface flaws. The advantages of using matched filter include some tolerance to alignment mismatches between the filter and the input image and, with normalization, tolerance to pattern intensity changes.

A known good image of the repetitive pattern is transformed into spatial frequency space using a fast Fourier transform (FFT) to make the matched filter. The FFT is then applied to input part images. Now in the spatial frequency domain, we divide the input image by the matched filter, effectively removing the spatial frequencies in the input image that match the matched filter’s frequencies. If we don’t care about the position and structure of the surface flaws, then the flaws can sometimes be detected in the spatial frequency domain. Or we use an inverse FFT to construct a spatial intensity image without the repetitive pattern’s structure and do the detection in the spatial domain.

If spatial frequencies in the flaws overlap those in the filter, the flaw will be partially erased. If there is enough overlap, the filtered signal won’t be strong enough to provide reliable flaw detection.

Structural Methods

Even after using the above methods, the flaw signal is often still too weak for reliable detection. Structural methods use prior knowledge of the structure of flaws to improve detection. For example, scratches appear in the image as points approximately in a line. By amplifying or accumulating points along a line, we can improve detection reliability for this type of flaw. Here are two of the many structural methods.

Mathematical morphology modifies and detects shapes (morphology) in the image. The erosion operation “peels off” pixels from bright objects’ edges. The dilation operation adds pixels to a bright object. Assume a scratch is brighter than the object it is on and that we know the approximate direction of the scratch. Then using directional dilation we can extend and “fatten” the points in the scratch so that they touch. Then directional erosion can, optionally, “thin” the resulting line, to also reduce noise pixels that were “fattened.” There are many other morphological operators that can be applied to improve flaw detection, assuming you know something about the flaw structure in advance.

In the Hough transform, each pixel above threshold “votes” for all possible lines it could be a part of. Possible lines with enough votes (above a threshold) indicate lines of pixels in the image that are scratches or cracks. Hough methods are able to detect very weak line signals because they integrate the evidence for a line over many pixels. They work very well in some situations but are often slow or too difficult to set up.

Every new surface flaw is a challenge but, with experience and the right tools, one that can be met. In this overview of methods I’ve, dare I say, only scratched the surface of this topic. V&S

 

References

http://en.wikipedia.org/wiki/Gestalt_psychology

http://www.mif.vu.lt/atpazinimas/dip/FIP/fip-Shading-2.html

“Image Morphology” by Ben Dawson, in July Vision and Sensors

http://www.qualitymag.com/articles/91228-image-morphology

http://en.wikipedia.org/wiki/Hough_transform

 

Ben Dawson is with Teledyne DALSA
Industrial Products, Inc.

(978) 670-2050

[email protected]

KEYWORDS: mathematics surface flaw detection

Share This Story

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

Ben Dawson is Director of strategic development for Teledyne DALSA Industrial Products Inc. [email protected].

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

iStock-1352825159-jpg.jpg

U.S. Should Substantially Boost Support for Manufacturing USA Program, Issue National Industrial Manufacturing Strategy, Says New Report

Dorsey Calibration Lab photo by Tom LaBarbera Picture this Studios

Ensuring Product Quality in a Competitive Manufacturing Landscape

Visions Sensors Ebook

eBook | How AI-driven Vision Systems Are Transforming Automotive Quality Control

2026 Quality Professional of the Year!

Events

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.
July 14, 2026

Quality Leaders Forum: Better Communication, Better Quality Data

The Quality Leaders Forum is a quarterly, editor-moderated fireside chat series hosted by Quality Magazine, featuring candid conversations with senior manufacturing and operations executives shaping enterprise-level quality.

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
Rookie of the Year Custom Content

Related Articles

  • Using Eddy Current Array in Detecting Cracks and Corrosion in Aircraft Longerons

    Using Eddy Current Array in Detecting Cracks and Corrosion in Aircraft Longerons

    See More
  • The Hough Transform in Machine Vision

    See More

Related Directories

  • ibg NDT Systems Corp.

    Design and build nondestructive eddy current test instruments and systems for material properties, crack detection and grinder burn.
×

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