Detect Scratches

Use this tool to detect scratches on surfaces. For this tool easyTouch is available. This means you may select the scratches to be detected interactively in the image while the corresponding parameters are adapted automatically.

Parameters

Basic Parameters

Image:

This parameter represents the image in which scratches should be detected.

If a color image is used as input image for this tool, only the first channel, i.e., the red channel, is used for the processing.

Scratch Width:

This parameter defines the width of the scratches to be detected. It is defined in pixels and set to 5.0 px by default. When a scratch is selected for detecting, the "Scratch Width" is instantly determined and adopted. However, you may also change its value manually at the corresponding connector.

Scratch Contrast:

The "Scratch Contrast" defines the contrast in gray values of the scratch relative to the background. The parameter is set to the value 10 by default. When a scratch is selected for detecting, the "Scratch Contrast" is instantly determined and adopted. However, you may also change its value manually at the corresponding connector.

Scratch Property:

This parameter defines the property, if the scratch appears dark or light with respect to the background. It is set to "dark" by default. If necessary, you can change the value at the corresponding connector.

Value

Description

light

Use this value, if the scratches to be detected appear light on a dark surface.

If this value is set, all light scratches are included in the detection.

dark

Use this value, if the scratches to be detected appear dark on a light surface.

If this value is set, all dark scratches are included in the detection.

Additional Parameters

ROI:

This parameter defines the region of interest (ROI) for processing. Image parts outside of the union of the ROI and "Processing Region" are not processed. In addition, if either of them is empty, the image part inside of the other one is processed. In case both of them are empty, the whole image is processed.

By default the ROI is defined as an empty ROI. If you want to use a non-empty ROI for the processing, you either have to connect the parameter to an appropriate ROI result of a previous tool or you have to draw new ROIs into the image using the available ROI buttons.

Alignment Data:

This parameter represents the alignment data that are used to align the ROI. By default no alignment data are connected and thus no effect is visible. If you want to use specific alignment data, you have to connect the parameter to an appropriate result of a previous tool such as Determine Alignment with Matching, Determine Alignment with Straight Border, Align Image, or Rotate Image.

Minimum Scratch Length:

This parameter defines the minimum length of the scratches to be detected. It is defined in pixels and set to 10 px by default. All scratches with a length of at least 10 px are included in the detection of scratches. When a scratch is selected for detecting, the "Minimum Scratch Length" of this scratch is instantly determined and adopted. However, you can change its value manually at the corresponding parameter.

Processing Region:

This parameter defines the region for processing. Image parts outside of the union of the ROI and "Processing Region" are not processed. In addition, if either of them is empty, the image part inside of the other one is processed. In case both of them are empty, the whole image is processed.

By default, "Processing Region" is defined as empty region. To specify a "Processing Region", you have to connect the parameter to an appropriate region result of a previous tool to make sure that a region is transmitted to this tool.

Results

Basic Results

Scratches:

This result contains the contours of the detected scratches. They are visualized in the defined color setting for 'ok', e.g., green by default.

Number:

This result contains the "Number" of detected scratches with the specified parameters. The result is returned as an integer number.

Length:

This result contains the "Length" of the detected scratches. If more than one scratch is detected, the corresponding lengths are returned as a tuple. They are returned as real number.

Straightness:

This result represents the "Straightness" of the detected scratches. It is given as a deviation value of the scratch to a fitted line of the scratch. The lower the value the straighter is the scratch.

Tool State:

"Tool State" returns information about the state of the tool and thus can be used for error handling. For more information, see Tool State Result

Additional Results

Scratches Regions:

This result contains the regions of the detected scratches. The number of "Scratches Regions" might differ from the result returned in "Number", especially if some scratches lie very close to each other.

Processing Time:

This result returns the duration of the most recent execution of the tool in milliseconds. The result is provided as additional result. Therefore, it is hidden by default but it can be displayed via the button beside the tool results. For more information see the section Processing Time in the tool reference overview.

Application Examples

This tool is used in the following MERLIC Vision App examples:

  • detect_only_scratches_with_photometric_stereo.mvapp
  • detect_scratches_on_metal.mvapp