Find Contour

This function block allows users to detect contours in a grayscale image. It provides options to choose the contour approximation method and set a minimum area for detected contours. The results include the selected contour, its position, rotation, and area.

📥 Inputs

Input Image (Gray) A grayscale image in which contours will be detected.

📤 Outputs

Selected Contour The contour that is currently selected based on user input.

Contours A list of all detected contours from the input image.

Contour Image The original image with the selected contour highlighted.

Object Position The position (center) of the selected contour.

Object Rotation The rotation of the selected contour.

Object Area The area of the selected contour.

Object Count The total number of detected contours.

🕹️ Controls

Minimum Contour Area % A slider that sets the minimum area percentage for contours to be considered valid.

Approximation Method A dropdown to choose the contour approximation method, such as Default, Simple, or various Teh-Chin methods.

Select Contour Object A dropdown to select a specific contour from the list of detected contours.

🎨 Features

Dynamic Contour Detection Capable of detecting contours in real time while providing visual feedback.

Multiple Methods for Contour Approximation Users can choose from various approximation methods to fine-tune the detection process.

Detailed Outputs Provides not only the detected contours but also relevant attributes such as area and rotation.

📝 Usage Instructions

  1. Input Image: Connect a grayscale image to the Input Image (Gray) input.

  2. Set Minimum Area: Adjust the Minimum Contour Area % slider to filter out small contours that are not of interest.

  3. Select Approximation Method: Choose the desired contour approximation method from the dropdown.

  4. Run the Node: Evaluate the block and examine the detected contours and their attributes.

  5. Select Specific Contour: If needed, select a specific contour from the Select Contour Object dropdown to focus on that contour's details.

📊 Evaluation

When executed, this function block generates a detailed analysis of contours within the input image, returning the selected contour alongside visual output.

💡 Tips and Tricks

Preprocessing

Use a Blur or Image Threshold function block before this one to clean up the input image, which can result in more accurate contour detection.

Contour Specificity

Adjust the Minimum Contour Area % for your specific use-case to filter out noise and undesired small contours.

Contour Visualization

After selecting a contour, you can visualize it on the output image easily to capture the contour more effectively.

Contour Limitations

If you are not receiving expected results, check the area limits and approximate settings. Going with defaults can often yield better initial results.

🛠️ Troubleshooting

No Contours Detected

If no contours are found, ensure that you're inputting a valid grayscale image, as contours cannot be detected from colored images.

Contour not Selected

Check if you have selected a valid index from the Select Contour Object dropdown. If no contours meet the criteria, adjust the minimum area or review the input image.

Last updated