Match Shapes
This function block compares two shapes (contours) and returns a resemblance score between 0 and 1. It is useful when you want a single numeric measure of how similar two contours are β where values closer to 1 mean the shapes are more similar.
π₯ Inputs
Contour β First contour to compare (reference).
Contour β Second contour to compare (query).
π€ Outputs
Resemblence β A number between 0 and 1 expressing how similar the two contours are (higher = more similar).
πΉοΈ Controls
Resemblence β A read-only label that displays the current resemblance value for quick feedback in the UI.
βοΈ Running mechanism
When the block runs it accepts two contour inputs, converts them into comparable representations, and computes a single resemblance score. The score is presented both as the output value and on the block's Resemblence label so you can see results immediately.
π― Features
Quick numeric similarity score for two contours.
UI feedback via a live resemblance label.
Works with contours produced by other shape analysis and detection blocks.
π How to use
Provide two contours to the inputs. Contours can come from detector or contour-processing blocks.
Run the flow; the block returns
Resemblenceand updates the label for instant inspection.Use the numeric output for decisions, logging, or further processing.
π‘ Tips and Tricks
If you only have an image, extract contours first using the
Find Contourblock, then feed the resulting contours into this block.To simplify complex contours (reduce noise or number of points) try
Approximate Contourbefore matching; simpler contours often yield more stable resemblance values.If you need the contour cropped into an image for visual comparison, use
Contour to Imageand preview the result withShow Image.To compare multiple candidate contours against a reference, combine this block with
Most Similar Shapeto automatically pick the best match.When matching shapes in specific regions, crop the image first using
Image ROI Selectso contours come from the expected area.If contours originate from images with different scales, normalize sizes with
Image Resizeor convert contours to cropped images of the same dimensions usingContour to Image.
π οΈ Troubleshooting
If the resemblance seems unexpectedly low: ensure both contours are similarly scaled and oriented. Try simplifying the contours with
Approximate Contouror normalizing their image sizes.If the output is unstable across frames, check the contour extraction step (e.g.,
Find Contour) for noisy detections and consider preprocessing withBlurorImage Threshold.No output or invalid contour input: verify the contour-producing block actually returns contour data (use
Debug Inputor preview intermediate images withShow Image).
Last updated
Was this helpful?