LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

curve fitting equation Hobby application

How would I find an equation for the curve from the datapoints in this vi. Eventually I would like to find an equation for the centerlines or the data values for the centerlines in the image. Maybe even the vision module could analyze the image. This is for my hobby of model railroading. I'm sure Ben will be interested in this one. I have a bunch of images like this that I want to analyze.
0 Kudos
Message 1 of 15
(3,987 Views)

Aren't these spline fits?

I have a fustercluck (not of my own making Smiley Mad ) that will keep me away from this challenge for a couple of days.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 15
(3,980 Views)
Most likely, the curve is a section of a circle (midpoint, radius).
 
You can use "fitting on a sphere" to find the midpoint (z=0) and radius. The lower code takes a unit circle and scales it according to the best fit to be overlayed over the data. Modify as needed. 🙂

Message Edited by altenbach on 05-03-2007 01:15 PM

Message 3 of 15
(3,959 Views)
The top curve is a constant radius, the bottom curve is a compound radius according to the manufacturer. And I have to keep this in a 7.0 world.

Message Edited by unclebump on 05-03-2007 05:56 PM

0 Kudos
Message 4 of 15
(3,942 Views)


@unclebump wrote:
The top curve is a constant radius, the bottom curve is a compound radius according to the manufacturer. And I have to keep this in a 7.0 world.

All the code shown is available in 7.0 (the icons might be a bit different).

"Fitting on a sphere" will give you a constant radius. I don't know what a "compound radius" curve is, do you have a formula?

0 Kudos
Message 5 of 15
(3,930 Views)
Do you have access to the polynomial fit PtbyPt.vi? It should give you the equation.  Not sure how it fits in with your ultimate goal.
Message 6 of 15
(3,915 Views)

I'm back on this one.

I have been interested in the Q for a while because when we have attmpted to use fixed radius approaches to this question when always ran into kinks somewhere.

The attached zip has LV 7.1 files for doing spline fits using the files included (fix file specs!).

Since I was more interested in learning how spline fits would work than in automating the image analysis, I resorted to a little editing using paint. I took the image you provided and saved it as a number of bmps'. The bmps have red pixels that define four points for each centerline. The four points are are pairs that define the trajectory of the track at each end ot the thurn out. I read these bmp's and get the cordinates of the pixels and then do a spline fit going through the four points. These are then plotted in a XY graph that overlays your picture.

The image above shows the results of the four bmps I defined. Two represnt the center lines of the two tracks in you picture. Two others show how the spline can beused to define centerlines of tracks approaching at trajectories that I defined.

Thanks for the picture. It made this experiment a lot more fun.

Ben

Message Edited by Ben on 05-05-2007 12:43 PM

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Download All
Message 7 of 15
(3,900 Views)
Thanks for the ideas. I got derailed by a honey-do mulching project.
0 Kudos
Message 8 of 15
(3,882 Views)
Ben, could you save your vi's back to 7.0 format. Thanks!!!!!!!!
0 Kudos
Message 9 of 15
(3,881 Views)
Here its is.
 
I do not know how well it translates back.
 
Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 10 of 15
(3,874 Views)