# LabVIEW

cancel
Showing results for
Did you mean:

## Unfolding arbitrary 2D shape perimeter onto graph axis

Hello NI forums,

I'm looking for some advice on how to proceed with a problem.
I'm working on a project that involves gathering laser time-of-flight data which is then displayed on an intensity graph. We are scanning the interior of sewer pipes to look for defects (erosion/encrustation - it's a dirty job but someone has to do it). This data is overlaid on an intensity graph with x-axis being degrees (0 to 360), and y axis being length; the z-axis is the intensity of encrustation/erosion.

We usually gather data from circular pipes, however for the current project we are gathering data from egg-shaped pipes which is a problem as our x-axis values (0-360 degrees) are not evenly spaced.

This brings me to my question: how can I determine these spacings on my x-axis? Is there any function in LabVIEW (or Python; Matlab etc.) or any mathematical function that will allow me to unfold the perimeter of the 2D pipe shape on to an axis so that I can display my data accurately? (I am aware this is somewhat similar to the 'coastline problem'!)

Any help in coming up with a solution for this would be greatly appreciated.

~AVD

I accept Kudos and BTC Tips :-D
Message 1 of 8
(211 Views)

## Re: Unfolding arbitrary 2D shape perimeter onto graph axis

Hi AVD,

Do you have a rough formula to use or an idea of how to turn your pipe into one? I've never tried but presumably there are approximations to be used. Maybe some of the people involved with the creation of the pipes would know?

If so, you can use a FormulaNode (http://www.ni.com/tutorial/7572/en/) to plot this.

Thanks,

Nick

Message 2 of 8
(114 Views)

## Re: Unfolding arbitrary 2D shape perimeter onto graph axis

Hi AVD,

isn't the angle (0° to 360°) the same, independent of the pipe cross section shape?

(The laser TOF might change due to different distances of pipe shell to pipe center, but the measurement is taken for the same degree/x axis value…)

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2019 sometimes) on Win7+cRIO
Kudos are welcome Message 3 of 8
(107 Views)

## Re: Unfolding arbitrary 2D shape perimeter onto graph axis

Am I correct that what you'd like to do is to put a "coordinate system" (a square or rectangular grid pattern) on the inside surface of a not-quite-circular pipe, and express this in something analogous to cylindrical coordinates, i.e. a "length" (down the center of the pipe) and an angular ("azimuth") coordinate?

This shouldn't be too difficult an inversion problem (you only have to worry about "azimuth"), but you do need an expression (in polar coordinates) for the cross-section.  You describe the pipe as "egg-shaped" -- I know an equation for an ellipse, and could probably work out the mapping from the center (not the focus!) of the ellipse to give equal arc spacing, but the last egg I encountered became an omelet (delicious!).  Can you provide a 3-5 parameter characterization of the cross-section?

Bob Schor

Message 4 of 8
(98 Views)

## Re: Unfolding arbitrary 2D shape perimeter onto graph axis

Hi all,

Thanks for all of your responses, Bob hits the nail on the head with his summary of the problem. As you say we are basically looking to put a coordinate system on the inside surface of the pipe then unfold this for our 2D graph of Encrustation/Erosion.

Unfortunately there is no formula for our pipes - they fit one of four standard egg-shaped profiles shown below. I drew these pipe shapes using Fusion 360, exported them as DXF, converted them to SVG (using inkscape), then imported them into LabVIEW using an SVG import tool found on the tools network. I then changed them so that they had unit height (as this is the main input variable), and saved them as XY data points in a .csv file (examples attached here).

I have made the current program so that I can calculate the distance from an arbitrary point in the pipe (wherever the LiDAR system is located) to a point on the circumference of the pipe. Calculated using some coordinate geometry - program attached. It still has a few bugs for certain angles.

This distance is the nominal (or ideal) distance which will then be compared to the actual data from the LiDAR system to calculate the amount of encrustation/erosion.

Which brings me to my next question (which might be better suited to a new post).

How can perform a best-fit of the ideal pipe shape to the data returned by the LiDAR system? I was thinking along the lines of linear regression but I don't have a function to fit the data to, just a set of X-Y points....

Thanks again,

AVD

I accept Kudos and BTC Tips :-D
Message 5 of 8
(77 Views)

## Re: Unfolding arbitrary 2D shape perimeter onto graph axis

Unfair!  Unfair!  You show some nice curves, complete with parameters (Egg 4:3, Angle (whatever that is), Centrepoint (whatever that means, other than where the "X" is located relative to 0, 0), Height (length of red line, Axis of symmetry), Length (?? possibly thickness of line in drawing?).  You clearly had some code that made the Drawings in Fusion 360 (which I've never used) -- does this use "canned" shapes, does it do some sort of parametric "distorsion" of a circle, is there some way "someone who might be interested" could derive a coordinate transformation?

Does the black X mark the relative location of the LiDAR device?

Bob Schor

Message 6 of 8
(69 Views)

## Re: Unfolding arbitrary 2D shape perimeter onto graph axis

To explain some of the parameters a bit further:

• Angle is the angle of the laser beam - the LiDAR system projects the laser from ~0-270
• Centrepoint is maybe a bit of a misnomer - this is the point at which the LiDAR system is located denoted by a black X
• Height is the input parameter for the height of the pipe

Fusion 360 is similar to solidworks, I defined the shapes (circles) and the relations (tangent, coincident etc.) in Fusion 360 according to the relations given at this link. So there is no formula for the shapes as such - which is proving to be a bit of a problem given that I can't just simply just fit the LiDAR data to the formula, it has to be fitted to this 'ideal' pipe cross-section given by the XY coordinates.

One idea that I had for fitting the raw LiDAR data to these shapes was perhaps using some of the pattern-matching IMAQ functions.... I guess my XY point cloud data could be converted into black&white images and then I could use the picture functions? (at the expense of the processing time needed to convert the data to images).

Or are there similar pattern matching functions for 2D point-cloud data?

AVD

I accept Kudos and BTC Tips :-D
Message 7 of 8
(60 Views)

## Re: Unfolding arbitrary 2D shape perimeter onto graph axis

Hi Nick,

@NPowl wrote:

Hi AVD,

Do you have a rough formula to use or an idea of how to turn your pipe into one? I've never tried but presumably there are approximations to be used. Maybe some of the people involved with the creation of the pipes would know?

If so, you can use a FormulaNode (http://www.ni.com/tutorial/7572/en/) to plot this.

Thanks,

Nick

I'm interested in trying this approach, however I think describing the shape using a general formula may be quite tricky (as myself and Bob have recently discussed). See image below for a description of the pipe shape with relationships defined in Fusion 360. Egg shaped pipe of unit height.

The shape consists of four circles of diameter:

1. 0.75 - top circle;
2. 1.50 - left hand side;
3. 1.50 - right hand side;
4. 0.125 - small circle on the bottom;

The distance from the top of the shape to the bottom of the shape (top of circle 1 to bottom of circle 4) is fixed and is 1 unit total. The top and bottom circles are fixed in space (in relation to each other) and the two side circles are fixed to the top and bottom circles by two tangent relationships (shown by the circle and line graphic).

I'm sure it's possible to define a general formula for this shape but how to go about it is another question!

Do you have any ideas on how I might approach this?

Best regards,

~AVD

I accept Kudos and BTC Tips :-D