Quadric curve fitting Root mean square

Feel free to ask any question here
Post Reply
visalprabhakaran
Posts: 3
Joined: Tue Mar 02, 2021 10:21 pm

Quadric curve fitting Root mean square

Post by visalprabhakaran »

Hi Daniel
I am a researcher trying to do Machine learning with the help of your amazing software.I am using your Geometric feature extraction feature to extract the gaussain curvature and Mean curvature for further machine learning.To further improve my understanding ,I wish to know how you use root mean square method to fit a curve on quadric surfaces z = a + b.x + c.y + d.x2 + e.xy + f.y2. Do you have any documentation that you reffered for that?
Can you share it here? Thank you in advance
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Quadric curve fitting Root mean square

Post by daniel »

Hi,

For reference, the code can be seen here: https://github.com/CloudCompare/CCCoreL ... d.cpp#L300

If I remember well, we minimize the (squared) error between the 'height' of the points (z) with respect to the height of the quadric surface at the same (x, y) position. It's a least squared approach. And to be more precise we use the Conjugate Gradient method to solve an 'tA.A.x=tA.b' equation (where tA is the transposed version of A).
Daniel, CloudCompare admin
visalprabhakaran
Posts: 3
Joined: Tue Mar 02, 2021 10:21 pm

Re: Quadric curve fitting Root mean square

Post by visalprabhakaran »

Thank you for the explanation.Sorry,I understood the explanation partially.I went to through the concept of Conjugate Gradient method.
I didnt understand What is A ?Is it the coordinates (X,Y) and what is b ?Is it the Z co ordinate?
I suppose x is the coefficients of a,b,c,d,e,and f of z = a + b.x + c.y + d.x2 + e.xy + f.y2.Am I right ?
Also in the documentation it was refered you used root mean square fitting to to determine the coefficients of the quadric equation.Why is written like that in the documentation ?
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Quadric curve fitting Root mean square

Post by daniel »

Well, it's more a 'trick' on how to represent this equation and the equality 'z = a + b.x + c.y + d.x2 + e.xy + f.y2' for all points as linear matrices.

A has 6 columns and as many rows as points in the cloud (let say N). On each row, you have: '1 x y x2 xy y2' (for each point).

Then the X matrix is the coefficients of the quadric (what we are looking for). So a simple vector of 6 values: 'a b c d e f'.

And you look for the X vector that minimises 'AX=b', where b is the 'z' coordinates of each point (a vector of N values).

But to actually solve the system, it's better / more efficient to have a square matrix, hence solving 'tA.A.X=tA.b' (where tA.A is square and only 6x6).
Daniel, CloudCompare admin
Post Reply