Shape Detector

This function block is designed to detect distinct shapes within a given input image. It provides a method to filter shapes based on various parameters, providing contours and area measurements for each detected shape.

📥 Inputs

Image This input accepts any image data in which shapes need to be detected.

📤 Outputs

Filtered Image An output image that shows the results of the shape detection process, including all detected contours.

Contoured Image This output highlights the detected shapes on the input image, providing visual feedback.

Border Coordinates The coordinates of the bounding rectangles around detected shapes, which can be used for further processing.

Center Positions The positions of the centers of the detected shapes.

Areas The area measurements of each detected shape, giving insight into the size of the shapes.

🕹️ Controls

Blur Coefficient A slider that allows you to adjust the amount of median blur applied to the input image before detection. This helps to reduce noise that might interfere with shape detection.

Auto Threshold A checkbox that enables the automatic calculation of the threshold values used for binary conversion of the image.

Threshold Range A range slider to manually set the threshold values for shape detection when the auto threshold is not selected.

Clear Spots Parameter A slider to set the size of the morphological kernel used for closing gaps between contours in the detected shapes.

🎨 Features

Shape Detection The block can identify and detect distinct shapes based on filtered input images.

Flexible Configuration Users can customize detection parameters such as blur amount, threshold values, and morphological features, resulting in tailored detection outcomes.

Visual Feedback Contours and centers of the detected shapes are visualized, providing immediate feedback on the detection results.

📝 Usage Instructions

  1. Connect Input: Link an image containing shapes to the Image input of the block.

  2. Set Blur Coefficient: Adjust the Blur Coefficient slider to control the amount of blur applied to reduce noise.

  3. Enable Auto Threshold (if desired): Check the Auto Threshold box to automatically calculate the threshold values, or leave it unchecked to set them manually using the Threshold Range slider.

  4. Set Clear Spots Parameter: Adjust the Clear Spots Parameter to refine the morphological processing applied to the thresholded image.

  5. Run the Block: Evaluate the block to detect shapes and retrieve filtered images, contours, coordinates, and areas.

📊 Evaluation

When executed, this function block performs shape detection on the input image based on the specified parameters and outputs the filtered image, contoured results, coordinates, center positions, and areas of all detected shapes.

💡 Tips and Tricks

Noise Reduction

Use a higher blur coefficient to filter out noise before detection, which helps in achieving cleaner detection results.

Setting Manual Threshold Values

If you find that the auto-threshold doesn't work well for your images, try adjusting the threshold range manually for better results.

Cutting Down Processing Time

If processing time is a concern, consider reducing the size of the input image or omitting unnecessary details that might result in superfluous detections.

Evaluating Shape Area

You can use the Areas output to get insights on the size of detected shapes, helping you to identify significant patterns or anomalies.

🛠️ Troubleshooting

No Shapes Detected

If no shapes are detected, try adjusting the threshold settings or the blur coefficient. Inspect the input image for sufficient contrast between shapes and their backgrounds.

Inaccurate Shape Detection

Check if the input image is too noisy or blurred. Modifying the Clear Spots Parameter can help refine detection output.

Last updated