<div dir="ltr">This seems the same as this already reported bug:<div><br></div><div><a href="https://github.com/PDAL/PDAL/issues/2939">https://github.com/PDAL/PDAL/issues/2939</a><br></div><div><br></div><div>If you want to submit a PR, I'll look it over.</div><div><br></div><div>Thanks!</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 5, 2020 at 6:36 PM Jim Klassen <<a href="mailto:klassen.js@gmail.com">klassen.js@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I am trying to do something similar (apply ICP on a subset of a large <br>
dataset) and am running into confusion over the transformation matrix in <br>
the metadata.<br>
<br>
The point cloud output of the ICP filter on the subset looks good. <br>
However when I try to use the resulting "transform" metadata as a input <br>
into filters.transformation.matrix over the full dataset, the resulting <br>
transformation moves the points wildly out of position.<br>
<br>
Looking at the code, in IterativeClosestPoint.cpp, it looks like the <br>
transformation matrix (T) is applied after shifting the point cloud to <br>
the centroid of the reference point cloud (C), and the shifted back to <br>
regular coordinates.<br>
<br>
So something like Pout = ((P - C) * T) + C<br>
<br>
Where P is a 4 element input point vector (x,y,z,1), Pout is the output <br>
point vector, C is the centroid vector (x,y,z,0), T is the 4x4 <br>
transformation matrix found by ICP.<br>
<br>
T is reported in the metadata for the stage, however, C is not reported <br>
in the metadata.<br>
<br>
But the transformation matrix that filters.transformation expects <br>
something more like<br>
<br>
Pout = P * T'<br>
<br>
If C is not (0,0,0) then T and T' will be different.<br>
<br>
I modified IterativeClosestPoint.cpp to also export the centroid to the <br>
metadata and then created a pipeline with three transformations, first <br>
shifting by the negative of the centroid, then applying T, then shifting <br>
back by the centroid and that produced the expected results.<br>
<br>
<br>
On 2/18/20 7:24 PM, Bradley Chambers wrote:<br>
> The options are very heavily borrowed from the PCL library, where this <br>
> was a squared value. Also, keep in mind that the default values may be <br>
> better suited for terrestrial/robotics applications (as opposed to <br>
> aerial), and will very likely need some tweaking.<br>
><br>
> The reported transformation should also be reported in row major <br>
> order, like the transformation filter. If you find it is not, I’d <br>
> consider that a bug, so feel free to file a ticket.<br>
><br>
> PRs are always welcome, especially for documentation!<br>
><br>
> Brad<br>
><br>
<br>
_______________________________________________<br>
pdal mailing list<br>
<a href="mailto:pdal@lists.osgeo.org" target="_blank">pdal@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/pdal" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/pdal</a></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature">Andrew Bell<br><a href="mailto:andrew.bell.ia@gmail.com" target="_blank">andrew.bell.ia@gmail.com</a></div>