LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calculate Distance between two points

Hi everyone!

 

This attached image below shown the image taken from live video and I want to measure the distance between two white dots (from the center) without drawing a line to measure it. How can it be done?

 

Thanks in advance.

 

distance.png

0 Kudos
Message 1 of 3
(6,326 Views)

Do you know the location of the dots? If so, just use trigonometry.

0 Kudos
Message 2 of 3
(6,320 Views)

Hi Enriquez,

 

For this kind of task you need NI Vision Development Module for LabVIEW. If you have it, then you can use the included Vision Assistant to design the algorithm and preview the results immedately. Here is one possible way (may not be the optimum one):

 

- Convert your RGB image to binary by using Color Threshold operation such that value '1' is assigned to the white dots and the rest is '0' (not of interest).

- Dilate the dots using Morphology operation to make the dots bigger (as long as they do not overlap).

- Use Circle Detection operation to locate the dots' center.

- Use Caliper operation to calculate the distance between two dots.

 

Screenshot:

Vision Assistant.jpg

 

The result I got was 93 pixels distance between a pair of horizontal dots, which you can then scale to real-world value. Above operations can be converted to LabVIEW VI for your use (Tools >> Create LabVIEW VI). In LabVIEW you can further customize the code to fit your requirements. For example, you can define a Region of Interest (ROI) that only includes two horizontal dots.

 

For more information, consult the Help files of NI Vision. You can try posting to the Machine Vision board as well to get better response. Hope this helps.

 

Regards,

 

Yodha

NI Singapore

Message 3 of 3
(6,257 Views)