Measure Object Distance

This function block measures the distance between two objects in a given image. By using this block, users can obtain exact measurements of the distance between specified templates within a reference image.

πŸ“₯ Inputs

Main Image The primary image that contains the objects whose distance is to be measured.

1st Object Image The template image of the first object.

2nd Object Image The template image of the second object.

πŸ“€ Outputs

Image Any The output will show the main image with the objects marked for measurement.

Distance The calculated distance between the two objects in the specified units.

X Distance The horizontal distance between the two objects.

Y Distance The vertical distance between the two objects.

πŸ•ΉοΈ Controls

Measure Factor An input field where you can specify a floating-point measure factor. This determines the scaling of the measurements.

Measured Distance A label that displays the calculated distance between the two specified objects.

Image Holder This area visually displays the modified main image with the measured objects highlighted.

🎨 Features

Distance Measurement Directly measures distances between two objects within an image using templates.

Customizable Measure Factor Users can adjust the accuracy of measurements via the measure factor, allowing for flexibility based on application needs.

Visual Feedback The output image helps to validate the measurement visually.

πŸ“ Usage Instructions

  1. Input Images: Connect your main image to the Main Image input, and connect the templates for the first and second objects to their respective inputs.

  2. Set Measure Factor: Input the desired measure factor in the Measure Factor field. This factor is used to scale the measured distance.

  3. Calculate Distance: When the block is evaluated, the distances will be calculated, and the results will be displayed in the output.

πŸ“Š Evaluation

When the block is executed, it will output the modified main image along with the calculated distances between the two specified objects.

πŸ’‘ Tips and Tricks

Improving Accuracy

Ensure both object templates are as clear and distinct as possible from the background to improve detection accuracy.

Measure Factor Settings

Adjust the Measure Factor based on the scale of the image. A factor closer to 1.0 is suitable for actual measurements, while lower values can be used for larger images.

Using Preprocessing Blocks

Before feeding your main image to this block, consider using preprocessing blocks like Image Threshold to create a more uniform background for better object detection.

πŸ› οΈ Troubleshooting

Distance Not Calculating

If distances are not being calculated, check that both object templates are correctly connected and distinct within the main image. Ensure that images are correctly formatted as expected inputs.

Incorrect Measurements

If the measurements seem off, verify the accuracy of your measure factor. Adjust it according to the specific scale of your images to ensure correct calculations.

Last updated