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
Provide a baseline image to the
Reference Imageinput.Provide the image to inspect to the
Actual Imageinput.Read the
Difference Imageoutput 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 Resizebefore this block so both inputs match.To load images from disk, pair with
Load ImageorLoad Image From Path.If images may be rotated or shifted, use
Auto Alignmentprior to subtraction to align images.For noisy inputs, use
BlurorDenoisingbefore subtraction to reduce false differences.To isolate changes to a specific region, crop the image with
Image ROI Selector apply a mask withApply Maskbefore feeding into this block.Combine the output with
Image Thresholdand morphological operations (e.g.,Morphological Transformations) to create a clean binary map of changes, then analyze with contour or shape analysis blocks.Use
Image LoggerorImage Writeto 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 ResizeorAuto Alignment.Too many small differences (noise): apply
BlurorDenoisingbefore subtraction, then applyImage Thresholdto filter minor variations.Differences due to lighting changes: consider color normalization using
Adjust Colorsor use grayscale conversion before subtraction.
Last updated
Was this helpful?