Example Code

Find Line Length or Distance Between Two Points in an Image

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • Vision Development Module
  • LabVIEW

Code and Documents

Attachment

Overview

The example demonstrates how to calculate the distance or length respectively between two points or a line of an IMAQ Image Region of Interest (ROI).

 

Description

The example shows how to use the Region of Interest (ROI) tools for an IMAQ Image to get the length of a line or the distance between two points. This can be helpful for performing distance measurements, defining calibration parameters, or comparing the size of components in an image.

 

Requirements

 Software

  • LabVIEW 2012 Base Development System (or compatible)
  • Vision Development Module 2012 (or compatible)

 Hardware

  • No hardware is necessary to use this example VI

 

Steps to Implement or Execute Code

  1. Open the attached file
  2. Run the VI
  3. Select the point tool or the line tool from the Image's ROI toolbox
  4. Draw a line or draw two points (hold SHIFT to draw multiple points)

 

Additional Information or References

IMAQ Image ROI calculate distance - Front Panel.png

 

IMAQ Image ROI calculate distance - Block Diagram.png

 

 

**The code for this example has been edited to meet the new Community Example Style Guidelines. The edited copy is marked with the text 'NIVerified'. Read here for more information about the new Example Guidelines and Community Platform.**

Daniel Hays | Test Software Business Manager

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Jony21
Member
Member
on

You help me so much

Not applicable
on

Sorry about my OOO msg... deleting it