Subtract Images

This function block compares two images by subtracting the second (reference) from the first (actual) and returns the resulting difference image. It is useful to highlight changes, defects, or motion between two aligned images.

πŸ“₯ Inputs

  • Actual Image (input socket) The image representing the current or test sample.

  • Reference Image (input socket) The image used as a baseline or reference to compare against the actual image.

πŸ“€ Outputs

  • Difference Image (output socket) The resulting image showing pixel-wise differences between the two inputs. Brighter/darker areas indicate where images differ.

πŸ•ΉοΈ Controls

This function block does not provide user-facing controls. It uses the two input sockets to produce the difference output.

🎯 Features

  • Simple and fast pixel-wise comparison for same-size images.

  • Produces a visual difference image that makes changes easy to see.

  • Intended for workflows where images are already aligned and the same dimensions.

πŸ“ How to use

  1. Provide a baseline image to the Reference Image input.

  2. Provide the image to inspect to the Actual Image input.

  3. Read the Difference Image output to see areas that have changed.

If the two images are not the same size, use an image resampling block before connecting (see Tips and Tricks).

βš™οΈ Evaluation

When run, this block performs a pixel-wise subtraction of the reference image from the actual image and outputs the resulting difference image. Visual inspection or further processing can be applied to the output to detect defects, motion, or changes.

πŸ’‘ Tips and Tricks

  • If images have different sizes, use Image Resize before this block so both inputs match.

  • To load images from disk, pair with Load Image or Load Image From Path.

  • If images may be rotated or shifted, use Auto Alignment prior to subtraction to align images.

  • For noisy inputs, use Blur or Denoising before subtraction to reduce false differences.

  • To isolate changes to a specific region, crop the image with Image ROI Select or apply a mask with Apply Mask before feeding into this block.

  • Combine the output with Image Threshold and morphological operations (e.g., Morphological Transformations) to create a clean binary map of changes, then analyze with contour or shape analysis blocks.

  • Use Image Logger or Image Write to save difference results when a significant change is detected.

πŸ› οΈ Troubleshooting

  • No clear differences visible: confirm both inputs are aligned and have identical dimensions. If not, use Image Resize or Auto Alignment.

  • Too many small differences (noise): apply Blur or Denoising before subtraction, then apply Image Threshold to filter minor variations.

  • Differences due to lighting changes: consider color normalization using Adjust Colors or use grayscale conversion before subtraction.

Last updated

Was this helpful?