MCPcopy Create free account
hub / github.com/PDAL/PDAL / teaser

Method teaser

plugins/teaser/filters/TeaserFilter.cpp:218–335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

216}
217
218void TeaserFilter::teaser()
219{
220 using namespace std::chrono; // steady_clock, duration_cast, microseconds
221
222 // Compute centroid of fixed PointView such that both the fixed an moving
223 // PointViews can be centered.
224 PointIdList ids(m_fixed->size());
225 std::iota(ids.begin(), ids.end(), 0);
226 Vector3d centroid = math::computeCentroid(*m_fixed, ids);
227
228 // Compute bounds of fixed PointView. All coordinates will subsequently be
229 // shifted by minimum values.
230 BOX3D fixedBounds, movingBounds;
231 m_fixed->calculateBounds(fixedBounds);
232 m_moving->calculateBounds(movingBounds);
233
234 m_bounds.clear();
235 m_bounds.minx = std::min(fixedBounds.minx, movingBounds.minx);
236 m_bounds.miny = std::min(fixedBounds.miny, movingBounds.miny);
237 m_bounds.minz = std::min(fixedBounds.minz, movingBounds.minz);
238 m_bounds.maxx = std::max(fixedBounds.maxx, movingBounds.maxx);
239 m_bounds.maxy = std::max(fixedBounds.maxy, movingBounds.maxy);
240 m_bounds.maxz = std::max(fixedBounds.maxz, movingBounds.maxz);
241
242 // To fit our data to the unit cube, we must also determine the appropriate
243 // scale by finding the max range in XYZ.
244 double xrange = m_bounds.maxx - m_bounds.minx;
245 double yrange = m_bounds.maxy - m_bounds.miny;
246 double zrange = m_bounds.maxz - m_bounds.minz;
247 m_scale = std::max(xrange, std::max(yrange, zrange));
248
249 // hack alert
250 m_bounds.minx = centroid.x();
251 m_bounds.miny = centroid.y();
252 m_bounds.minz = centroid.z();
253 m_scale /= 2;
254
255 // T will contain the final affine transformation.
256 Affine3d T = Affine3d::Identity();
257
258 // Choose one of two registration approaches depending on whether FPFH
259 // correspondences are to be used or if TEASER will run correspondence
260 // free.
261 steady_clock::time_point begin = steady_clock::now();
262 if (m_fpfh)
263 T = fpfh();
264 else
265 T = nofpfh();
266 steady_clock::time_point end = steady_clock::now();
267
268 // Log results
269 log()->get(LogLevel::Debug)
270 << "=====================================" << std::endl;
271 log()->get(LogLevel::Debug)
272 << " TEASER++ Results " << std::endl;
273 log()->get(LogLevel::Debug)
274 << "=====================================" << std::endl;
275 log()->get(LogLevel::Debug) << "Estimated rotation: " << std::endl;

Callers

nothing calls this directly

Calls 15

computeCentroidFunction · 0.85
calculateBoundsMethod · 0.80
strMethod · 0.80
logFunction · 0.50
getMetadataFunction · 0.50
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
clearMethod · 0.45
xMethod · 0.45
yMethod · 0.45
zMethod · 0.45

Tested by

no test coverage detected