[pdal] filters.icp transformation
Jim Klassen
klassen.js at gmail.com
Thu Mar 5 15:36:53 PST 2020
I am trying to do something similar (apply ICP on a subset of a large
dataset) and am running into confusion over the transformation matrix in
the metadata.
The point cloud output of the ICP filter on the subset looks good.
However when I try to use the resulting "transform" metadata as a input
into filters.transformation.matrix over the full dataset, the resulting
transformation moves the points wildly out of position.
Looking at the code, in IterativeClosestPoint.cpp, it looks like the
transformation matrix (T) is applied after shifting the point cloud to
the centroid of the reference point cloud (C), and the shifted back to
regular coordinates.
So something like Pout = ((P - C) * T) + C
Where P is a 4 element input point vector (x,y,z,1), Pout is the output
point vector, C is the centroid vector (x,y,z,0), T is the 4x4
transformation matrix found by ICP.
T is reported in the metadata for the stage, however, C is not reported
in the metadata.
But the transformation matrix that filters.transformation expects
something more like
Pout = P * T'
If C is not (0,0,0) then T and T' will be different.
I modified IterativeClosestPoint.cpp to also export the centroid to the
metadata and then created a pipeline with three transformations, first
shifting by the negative of the centroid, then applying T, then shifting
back by the centroid and that produced the expected results.
On 2/18/20 7:24 PM, Bradley Chambers wrote:
> The options are very heavily borrowed from the PCL library, where this
> was a squared value. Also, keep in mind that the default values may be
> better suited for terrestrial/robotics applications (as opposed to
> aerial), and will very likely need some tweaking.
>
> The reported transformation should also be reported in row major
> order, like the transformation filter. If you find it is not, I’d
> consider that a bug, so feel free to file a ticket.
>
> PRs are always welcome, especially for documentation!
>
> Brad
>
More information about the pdal
mailing list