From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Obtaining Accurate Line Lengths Using the polyline tool

I am interested in getting accurate length information for a line drawn with the polyline tool.  As an example, say I have five line segments that make up the polyline, with each segment of the polyline line drawn at a different angle.  IMAQ ROIProfile will deliver pixel coordinates once the line is ended, but is there a way to get ahold of the individual segment start and end point coordinates?  If I could get access to the start and end points of each section, I can calculate line length of each segment based on the number of pixels and angle that the segment was drawn through.  Then I could just add the segment lengths together.  I am not sure how to use the information coming out of IMAQ ROIProfile to do what I need to here. Perhaps there is another approach that I have not thought of.

0 Kudos
Message 1 of 3
(4,681 Views)

Don,

 

If you just unbundle the ROI, you can get the data you want.  It will take a little work to figure out the format, but it isn't too difficult.  If I remember correctly, the points are listed as alternating X and Y values in an array inside the ROI.  If you create a polyline then examine the ROI you should be able to figure it out pretty quickly.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 3
(4,678 Views)

Sorry, duplicate post.

Bruce Ammons
Ammons Engineering
0 Kudos
Message 3 of 3
(4,678 Views)