Detect Reference
This function block searches a reference image inside a larger image and returns visual and numeric match results. It is useful when you want to automatically find where a known object appears in a scene, even if it is rotated, resized, or mirrored.
π₯ Inputs
Image The input image in which the reference will be searched (main scene). This is an input socket.
Reference The reference object image to find inside the main image. This is an input socket.
Mask Optional mask to limit the search area or ignore parts of the reference. This is an input socket.
π€ Outputs
Image Any An output image with visual annotations showing detected matches (if drawing is enabled). This is an output socket.
Object Positions Center coordinates of each detected instance. This is an output socket.
Object Count Total number of detected instances. This is an output socket.
Rectangle Coordinates Bounding rectangle coordinates for each detection. This is an output socket.
Match Percentage Per-detection confidence or match score(s). This is an output socket.
πΉοΈ Controls
Match Threshold % Slider to eliminate low-confidence matches. Higher values reduce false positives.
Down-size Slider to reduce image size for faster processing. Smaller images run faster but may lose fine details.
Rotations Slider to set how many angle slices are tested (more slices increase robustness to rotation but increase runtime).
Sweep Angle Range selector that sets the rotation sweep (start and end angles) to explore during matching.
Include Flipped Checkbox to include a horizontally flipped version of the reference in the search (useful for mirrored objects).
Method Dropdown to choose the matching estimation method; options provide trade-offs in accuracy and behavior.
Color Mode Dropdown to switch between grayscale and full color comparison (BGR). BGR mode is usually more accurate for textured/colorful references.
π¨ Features
Rotation-tolerant matching: searches across a sweep of rotation angles to find rotated instances.
Scale/performance control:
Down-sizelets you trade accuracy for speed.Optional flipped-search: find mirrored appearances by enabling
Include Flipped.Mask support: feed a
Maskto ignore parts of the reference or the scene.Color-aware mode: choose between grayscale and BGR matching to improve results on color-rich references.
Visual and numeric outputs: annotated image, center points, bounding rectangles, counts, and match confidences.
βοΈ How it runs
The block optionally reduces image sizes when
Down-sizeis set to speed up processing.The reference is tested across multiple rotation slices defined by
RotationsandSweep Angle.If
Include Flippedis enabled, the flipped reference is also tested.The selected
MethodandColor Modedetermine how each candidate match is scored.Matches that meet or exceed
Match Threshold %are reported and optionally drawn on the output image.Results are returned as an annotated image, a list of center coordinates, a count, rectangle coordinates, and match percentage(s).
π Usage Instructions
Provide the scene image to
Imageand the reference sample toReference. Optionally provide aMaskto restrict matching areas.Start with moderate settings: set
Match Threshold %around 50β70 and keepRotationsandDown-sizelow.Inspect results using the annotated
Image Anyand theObject Positions/Object Countoutputs.Adjust controls: increase
Rotationsfor heavily rotated objects, lowerDown-sizefor better accuracy, or switch toColor ModeBGR for color-sensitive matches.Use the mask to reduce false positives when the reference has background or repetitive patterns.
π‘ Tips and Tricks
If your input images are very large, add
Image ResizeorImage Resizerbefore this block to speed up processing while preserving needed detail.Crop to the area of interest with
Image ROI Selectto reduce search area and false matches.Preprocess the input with
Blur,Denoising, orContrast Optimizationto reduce sensor noise and improve match stability.Use
Image ThresholdorBackground Removal (RMBG-1.4)when the reference has a clear foreground/background separation to simplify matching.Preview and inspect detections with
Show Imageto open a larger image viewer.Overlay detection rectangles or labels using
Draw Detectionsif you want a tailored visualization for reports or downstream processing.Log examples of detected results with
Image Loggerfor dataset curation or debugging.
(hint: combining these blocks can speed up matching and reduce false positives β for example, crop with Image ROI Select, enhance contrast with Contrast Optimization, then run this block.)
π οΈ Troubleshooting
No matches found: try lowering
Match Threshold %, increaseRotationsif the object may be rotated, or switchColor Modeto BGR.Too many false positives: increase
Match Threshold %, provide a tighterMask, or crop input withImage ROI Select.Slow performance: reduce
Rotationsor increaseDown-size. Only enableInclude Flippedwhen necessary.Partial or inconsistent matches: use a higher-quality reference (clear, high contrast), preprocess with
BlurorContrast Optimization, or try the BGRColor Mode.
If issues persist, try combining small preprocessing steps (resize β denoise β crop) to make the reference stand out from the background.
Last updated
Was this helpful?