Most Similar Shape

This function block is designed to identify the contour from a set of contours that is most similar to a given reference contour. It outputs the most similar shape along with a similarity score and an annotated image.

πŸ“₯ Inputs

Contour The reference contour that you want to compare against other shapes.

Contour(s) A collection of contours that will be evaluated for similarity with the reference contour.

Image Any An input image on which the contours will be visually marked.

πŸ“€ Outputs

Most Similar This output provides the contour that is determined to be the most similar to the reference.

Score (0-1) Outputs a similarity score between the reference contour and the most similar contour, where a score of 1 indicates a perfect match.

Image Any An annotated version of the input image displaying the most similar contour highlighted.

πŸ•ΉοΈ Controls

This function block does not have specific controls but relies on the configurations of the inputs described above.

🎨 Features

Contour Comparison Utilizes shape matching algorithms to evaluate the likeness of contours based on their geometric properties.

Visual Feedback Highlights the most similar contour directly on the input image for clear visual confirmation.

πŸ“ Usage Instructions

  1. Input Contour: Connect a single contour to the Contour input as a reference shape.

  2. Input Contours: Connect a list of contours to the Contour(s) input for comparison against the reference.

  3. Input Image: Optionally, connect an image to visualize the result and the most similar contour.

  4. Evaluate: Run the block to find and output the most similar contour along with its similarity score and an annotated image.

πŸ“Š Evaluation

When executed, this function block analyzes the provided contours and determines which one most closely resembles the reference shape. It returns the most similar contour, the similarity score, and an annotated image indicating the match.

πŸ’‘ Tips and Tricks

Preprocessing Contours

Before inputting contours, consider using Morphological Transformations to enhance or smooth the shapes, making it easier to obtain accurate matches.

Thresholding the Image

If the contours are derived from an image, applying the Image Threshold function block may help in creating cleaner binary contours for better matching results.

Handling Multiple Contours

When working with a dynamic range of contours, filter out any irrelevant or low-quality contours before inputting them to improve matching accuracy.

πŸ› οΈ Troubleshooting

No Similar Shapes Detected

Ensure that the reference contour is correctly defined and the target contours are valid. If no valid contours are presented, the output may not yield expected results.

Unexpected Score Values

If you receive a score that seems incorrect, check the input contours. Ensure they all represent valid geometric shapes that can be meaningfully compared.

Last updated