Flattening of a 2D surface

Feel free to ask any question here
mfloris
Posts: 12
Joined: Thu Sep 18, 2014 9:19 am

Flattening of a 2D surface

Post by mfloris »

Hello everyone,

I scanned a flat surface with a microepsilon laser line scanner. Due to mechanical constraints the scanner was rotating above the surface instead of translating.

As a result, my cloud is not flat but slightly curved. I would like to make it flat.

I fitted a 2.5 quadric to the cloud and obtained

Code: Select all

[14:59:23] [doActionFitQuadric] Quadric equation: z = 0.191051 + 3.54919e-05 * x + 0.0012838 * y + -0.00411161 * x^2 + 0.00332096 * x.y + -0.000473921 * y^2
I could use this information to "flatten" the point cloud using Matlab or any other tool to rectify the surface, but is there a quick way to do it inside CloudCompare?

Thank you for your support
daniel
Site Admin
Posts: 7710
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Flattening of a 2D surface

Post by daniel »

Nope ;)
Daniel, CloudCompare admin
mfloris
Posts: 12
Joined: Thu Sep 18, 2014 9:19 am

Re: Flattening of a 2D surface

Post by mfloris »

Merci quand même :D

Last question: what does the point mean in "x.y" ? If I replace it with an "*" the result of the equation makes no sense...
daniel
Site Admin
Posts: 7710
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Flattening of a 2D surface

Post by daniel »

Yes it is 'x*y'.

But the information output in the console is incomplete:
- the axes may be changed (so as to use as 'Z' dimension the one along which the cloud is the more flattish)
- and the coordinates (and equation) are expressed relatively to the center of gravity of the input cloud

We may have to change this (now that someone is actually using it ;).

P.S.: I would be interested to see how you "simply" back project a point on the quadric? (orthogonally to the quadric surface)
Daniel, CloudCompare admin
mfloris
Posts: 12
Joined: Thu Sep 18, 2014 9:19 am

Re: Flattening of a 2D surface

Post by mfloris »

daniel wrote:- the axes may be changed [...]
- and the coordinates (and equation) are expressed relatively to the center of gravity of the input cloud
Well this explains why simply subtracting the calculated z(x,y) from the z-coordinate of each point in the cloud wreaks havoc (especially the second point)

I know my back projection is not even remotely correct or precise, but if I needed precision I would have insisted on a proper setup with linear encoder. I now have to try and get the most from badly scanned clouds ;)

PS: VERY IMPORTANT - before fitting the 2.5D Quadric, I fitted a plane and transformed the input cloud so that the plane became horizontal. This is why I was hoping to be able to work only on the 'Z' coordinate ;)
daniel
Site Admin
Posts: 7710
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Flattening of a 2D surface

Post by daniel »

Then the Z should be good. I bet this is all about the gravity center?
Daniel, CloudCompare admin
mfloris
Posts: 12
Joined: Thu Sep 18, 2014 9:19 am

Re: Flattening of a 2D surface

Post by mfloris »

daniel wrote:Then the Z should be good. I bet this is all about the gravity center?
It's like you said, the output formula doesn't reproduce the actual points of the fitted quadric surface

I am now comparing the saved output cloud produced by "Fit 2.5D quadric" with a cloud that I reproduced by calculating myself the 'Z' value using the output formula.

They look alike but they don't match at all. The calculated cloud is centered in Z=0 but even if I translate it along Z, is 4mm thick whereas the original one is 1.4mm , confirming what you said about being oriented along the Z that makes it more "flattish". I tried to rotate it manually but with no luck.

How do I get the COG of the original input cloud?
daniel
Site Admin
Posts: 7710
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Flattening of a 2D surface

Post by daniel »

Have you a compiled version or are you using the online binaries?

If you have a compiled version it would be pretty easy to display it, otherwise I'll have to update the default trace (and I'll do it anyway - I should be able to do it this evening).
Daniel, CloudCompare admin
mfloris
Posts: 12
Joined: Thu Sep 18, 2014 9:19 am

Re: Flattening of a 2D surface

Post by mfloris »

I have the latest windows binaries

I'm really curious about finding out whether changing the coordinates of the formula would make an improvement.

My hope is that by using the output formula as it is I am reconstructing the "wrong" part of the surface, and when I try to superimpose it to my cloud it obviously doesn't fit.

If that is true, by replacing

Code: Select all

z = 0.191051 + 3.54919e-05*x + 0.0012838*y + -0.00411161*x^2 + 0.00332096*x*y + -0.000473921*y^2
with

Code: Select all

z = ( 0.191051 + 3.54919e-05*(x + COGx) + 0.0012838*(y + COGy) + -0.00411161*(x + COGx)^2 + 0.00332096*(x + COGx)*(y + COGy) + -0.000473921*(y + COGy)^2 ) + COGz
I should get the right points in space.

If that is not true, I should "rotate the formula" in space and I have no idea how to do it.
daniel
Site Admin
Posts: 7710
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Flattening of a 2D surface

Post by daniel »

Then I'll update the displayed formula so that you can use your points directly (I'll change the letters depending on the real 'Z' dimension - in your case it shouldn't change anything - and I'll update the constant coefficient so as to take the shift to the center into account).

I'll post a new message this evening when this will be done.
Daniel, CloudCompare admin
Post Reply