Page 1 of 1

How to get relative errors after plane fitting

Posted: Wed Nov 26, 2014 8:29 pm
by roy.korin
Hi,

First, I would like to really thank the developer(s) for this impressive program. My question is as follows:
I am evaluating the performance of a depth sensor. I want to capture a large flat target (e.g. a long wall) and check the captured depth map uniformity and the error relative to distance from the sensor, meaning the pixel Z error relative to 'ground truth' pixel, which is the Z value on the theoretically perfect plane.
My procedure is: import a PLY of the captured plane. Perform 'fit to plane'. Run 'calc cloud - mesh distances'. Export the results as CSV file. The results is, according to my understanding, I have for each pixel of the captured image its XYZ value, and the distance (normal) of this pixel to the fitted plane. What I wish to get is the expected Z value of this pixel if it was on the plane, since I want to calculate for each pixel Z_on_fitted_plane - Z_in_captured_image. In this way I will get the Z error relative to the distance from the sensor.

My problem is I don't know how to get the pixel's 'expected Z value of this pixel if it was on the plane', which is 'Z_on_fitted_plane' in the formula above.
Looking forward to hear you recommendations.

Roy Korin.

Re: How to get relative errors after plane fitting

Posted: Wed Nov 26, 2014 11:44 pm
by daniel
Hi,

I'm not sure to clearly understand. Do you want to project the points on the plane in a 'projective' way? i.e. by intersecting the line coming from the sensor optical center and going through the measured point with the plane?

Re: How to get relative errors after plane fitting

Posted: Thu Nov 27, 2014 12:12 pm
by roy.korin
Hi Daniel,

No, I don't want to project the points. I have the captured image pixels in XYZ format, and CloudCompare gives the distances to the fitted plane and the normal of that plane.
What I want to have is (per pixel) the error in Z component only between the captured pixel and the fitted plane.

I hope it is clearer now.

Thanks,
Roy Korin.

Re: How to get relative errors after plane fitting

Posted: Thu Nov 27, 2014 1:24 pm
by daniel
Isn't your plane vertical already(i.e. Z = constant in your case)? In which case the orthogonal distance is already the distance along Z.

Otherwise, you can only separate the distance "components" along X, Y and Z when computing distances between two clouds right now.

Re: How to get relative errors after plane fitting

Posted: Thu Nov 27, 2014 10:37 pm
by roy.korin
Daniel,

I understand. If so, is there any way to convert the fitted plane into a point cloud?

Roy.

Re: How to get relative errors after plane fitting

Posted: Fri Nov 28, 2014 7:45 am
by daniel
Ah yes, but I didn't want to start this subject at first ;)

You can call 'Edit > Sample points' on your plane so as to create a point cloud. Then you could compute cloud/cloud distances but the drawback is that the result is unsigned (and the cloud density can induce an error so you have to use a 'local modelling strategy' - the least square plane obviously in this case).

But now that I think of it, you should instead use the qM3C2 plugin to compute the distances between your cloud and the sampled one (see http://www.cloudcompare.org/doc/wiki/in ... PluginM3C2). This way you'll get clean and signed distances.

P.S.: as we say in France, it's like a "hammer to kill a fly". The "Z distance" you are trying to compute is simply the dot product of the vector from your point to any point of the plane and the plane normal. So if you know let say C the center of the plane, N the normal of the plane (CC gives you all this) then you can simply compute for all point P of your cloud:

Code: Select all

dist_z = CP.N = (Cx-Px).Nx + (Cy-Py).Ny + (Cz-Pz).Nz
You can even do this in Excel if you don't have too much points.

Re: How to get relative errors after plane fitting

Posted: Sun Nov 30, 2014 2:13 am
by roy.korin
Daniel, thanks for the advise. I will try it.

Regards,
Roy.

Re: How to get relative errors after plane fitting

Posted: Sun Nov 30, 2014 7:02 pm
by Gilh
Hello Daniel,

I'm Gil, I work with Roy.
I was trying you suggestion with the dot product, but I was not sure which vector is the normal to the plane.
Is it the "Axis" vector?

Thanks,

Gil

Re: How to get relative errors after plane fitting

Posted: Sun Nov 30, 2014 9:10 pm
by daniel
Hi,

When you fit a plane, you get its 'normal' in the Console:
cc_fit_plane_normal.jpg
cc_fit_plane_normal.jpg (19.92 KiB) Viewed 5918 times
It corresponds to the 3rd column of the "Transformation history" matrix.