How to cancel errors of 3d scan alignments?

Hi!

I have a problem where I cannot find a solution and neither I understand if a solution can be found.

The context is the alignment of 3d scan data. Each scan have errors, but my hope is to cancel, to “average-out” the errors by making more scans of the same details.

Here in the attached file I have 6 planes (resulting of scanning cylindrical elements).
I have prepared the data as if the scan was made 3 times.
If the 3 scans are already in the correct place, you can see how the simply average of plane positions and Z axes perfectly achieve the original data (round integer positions and perfect Z direction).
(I do not care for the X and Y direction, just the planes origin and normal, Z axis)

Now, creating a more realistic scenario, I randomly rigid-move the 3 sets of 6 planes.
I expect it should be possible to re-align together the 3 sets, rebuilding the correct relative position of the planes and relative direction… but I can’t find a method that do that correctly.
I always get some remaining error…

alignment of sets of planes.gh (14.8 KB)

The actual starting data is from the green group.

Thanks in advance!

I don’t know if I understood the question correctly, but I’ll try this way.
alignment of sets of planes a.gh (14.2 KB)

The relative position between the 6 planes of the example should be the same as the ones created by the two average components in my definition, they fall exactly at 10,10 20,10 30,10 etc etc…

Your solution create different relative positions..

in your real-life scenario, are the 6 entities always taken in the same order, so the first is always first, second is always second and so on?

Yes.

a beautiful thing about this problem, I came back to this like 5 times in the last couple of days, each single time I had the breakthrough solution in mind, and each single time it didn’t work -at all-

but even if anything worked and I didn’t get any result, the exploration itself was a beautiful roam

there are a couple of things I tried, sharing here just for reference, the first idea was -of course- the noob brute-forcing galapagos approach, using xyz sliders for translation, and xy, zx and yz rotationin, in such a way to try to bring two out of the three set of planes to overlap the first one

weird stuff going on of course, the precision depends on the decimals of the sliders, using degrees instead of radians helps on that matter, but at the end of the game the real problem is the fitness: how to define/evaluate a good result?

I thought a good way would be to check the sum of the vector_Z of each of the 6 plane triplets: those had to be parallel to each other (or as parallel as apossible)

then I thought “hey, but why galapagos if we can Kangaroo!!!”, and did a weird thing with rigid points, and Line connecting triplets of planes that had to go to length = zero… and then (it was already the second day of experiments) I thought “let’s check the inverse transformation of those planes”, and saw that the triplets do not share the same origin point of course :slight_smile:

so everything I tried was bad and wrong :slight_smile:

the logic somehow has something in common with the chandelier problem, where you have the top view of a circular chandelier with n equally spaced candles along it circumference, and have to add/remove a finite number of candles while keeping it balanced over its center

in your scenario, imagine each different set of 3D scan is like a new candle that you place somewhere on the chandelier, without knowing exactly where (that’s the point of the problem I guess)

how to make sure (or even to measure) that/if the different scans are sort of “equally distributed error-wise”, not knowing where the center is?

1 Like

Interesting! I’ll study that.

That’s what I hope/expect: a “pure” random error distribution.
Realistically it won’t be, but I want to start building a logic from this anyway.


Indeed! Right!


planes orientation 2.gh (29.2 KB)

It seems that with a huge amount of 3d scansion repetitions the error actually can be shrinked with a simple average in the last step… but I won’t have that huge amount of repetitions. I’m wondering if this can be achieved with much fewer repetitions.

How is this done in Cloud Compare software when it merges point clouds with millions of points?

Is it just done on point location or does it also look at the normal scalar field values?

I have no idea… maybe I’m reinventing the wheel but I need to do this inside rhino.

My planes are a “derived information”, initially those are indeed a mesh from a 3d scanner where I manage to get the best fitting plane for each position.
Then I’m using just the planes to find the “average” … but you are right, maybe I should use the original mesh data to find the overall best fit.
Quite a mess.

To recover from an alignment error, reduce the distance from a previously completed scan by half and try again. If this doesn’t work, delete the previously completed scan and scan over that spot again. Repeat this process of deleting and rescanning until you have recovered alignment.