🖥
🖥
🖥
🖥
AugeLab Studio Manual
English
Ask or search…
K
Comment on page

Most Similar Shape

Most Similar Shape Node Documentation

The Most Similar Shape node in AugeLab Studio calculates the resemblance between a reference contour and a list of target contours. It selects the contour that is most similar to the reference contour based on a shape matching score. It outputs the most similar contour, the shape matching score, and an image with the most similar contour drawn.

Node Overview

The Most Similar Shape node takes a reference contour, a list of target contours, and an optional image as inputs. It provides the following outputs:
  1. 1.
    Most Similar: The contour from the list of target contours that is most similar to the reference contour.
  2. 2.
    Score (0-1): The shape matching score between the most similar contour and the reference contour. The score is normalized to a range of 0 to 1, where a score of 1 indicates a perfect match.
  3. 3.
    Image: An image with the most similar contour drawn.

Node Properties

  • Node Title: Most Similar Shape
  • Node ID: OP_NODE_MOST_SIMILAR_SHAPE

Inputs

The Most Similar Shape node has the following input sockets:
  1. 1.
    Contour: The reference contour to compare against.
  2. 2.
    Contour(s): The list of target contours to compare with the reference contour.
  3. 3.
    Image: An optional image on which to draw the most similar contour.

Outputs

The Most Similar Shape node has the following output sockets:
  1. 1.
    Most Similar: The contour from the list of target contours that is most similar to the reference contour.
  2. 2.
    Score (0-1): The shape matching score between the most similar contour and the reference contour. The score is normalized to a range of 0 to 1, where a score of 1 indicates a perfect match.
  3. 3.
    Image: An image with the most similar contour drawn.

Node Interaction

  1. 1.
    Connect a reference contour to the Contour input socket of the Most Similar Shape node.
  2. 2.
    Connect a list of target contours to the Contour(s) input socket of the Most Similar Shape node.
  3. 3.
    Optionally, connect an image to the Image input socket of the Most Similar Shape node.
  4. 4.
    Run the pipeline.
  5. 5.
    The output sockets will provide the most similar contour, the shape matching score, and an image with the most similar contour drawn.

Implementation Details

The Most Similar Shape node uses the OpenCV function cv2.matchShapes to calculate the shape matching score between the reference contour and each target contour. The node iterates through the list of target contours, scales them to match the size of the reference contour, and compares their shapes using the shape matching score. The contour with the lowest shape matching score (closest match) is selected as the most similar contour.
The shape matching score is normalized to a range of 0 to 1, where a score of 1 indicates a perfect match. The score is then subtracted from 1 to obtain a resemblance score, where a higher score indicates a higher resemblance between the contours.
If an image is provided as input, the node draws the most similar contour on the image using a specified line width. This allows for visual inspection of the selected contour.

Usage

  1. 1.
    Drag and drop the Most Similar Shape node from the node library onto the canvas in AugeLab Studio.
  2. 2.
    Connect a reference contour to the Contour input socket of the Most Similar Shape node.
  3. 3.
    Connect a list of target contours to the Contour(s) input socket of the Most Similar Shape node.
  4. 4.
    Optionally, connect an image to the Image input socket of the Most Similar Shape node.
  5. 5.
    Run the pipeline.
  6. 6.
    The output sockets of the Most Similar Shape node will provide the most similar contour, the shape matching score, and an image with the most similar contour drawn.

Notes

  • The Most Similar Shape node is useful for comparing a reference contour to a list of target contours and finding the contour that most closely matches the reference contour.
  • The node calculates a shape matching score to determine the resemblance between the contours. A lower score indicates a closer match.
  • The output socket Most Similar provides the contour from the list of target contours that is most similar to the reference contour.
  • The output socket Score (0-1) provides the shape matching score between the most similar contour and the reference contour. The score is normalized to a range of 0 to 1, where a score of 1 indicates a perfect match.
  • The output socket Image provides an image with the most similar contour drawn. This allows for visual inspection of the selected contour.
  • Ensure that the reference contour and the list of target contours are correctly connected to the corresponding input sockets of the Most Similar Shape node.
  • The output contour and image can be used for further analysis or visualization.
That concludes the documentation for the Most Similar Shape node in AugeLab Studio. Use this node to compare a reference contour to a list of target contours, find the most similar contour, and obtain the shape matching score. The node provides the most similar contour, the score, and an image with the most similar contour drawn for further analysis or visualization.