本文整理汇总了C++中OcTree::insertPointCloudRays方法的典型用法代码示例。如果您正苦于以下问题:C++ OcTree::insertPointCloudRays方法的具体用法?C++ OcTree::insertPointCloudRays怎么用?C++ OcTree::insertPointCloudRays使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OcTree
的用法示例。
在下文中一共展示了OcTree::insertPointCloudRays方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
num_points_in_graph = graph->getNumPoints();
cout << "\n Data points in graph: " << num_points_in_graph << endl;
}
// transform pointclouds first, so we can directly operate on them later
for (ScanGraph::iterator scan_it = graph->begin(); scan_it != graph->end(); scan_it++) {
pose6d frame_origin = (*scan_it)->pose;
point3d sensor_origin = frame_origin.inv().transform((*scan_it)->pose.trans());
(*scan_it)->scan->transform(frame_origin);
point3d transformed_sensor_origin = frame_origin.transform(sensor_origin);
(*scan_it)->pose = pose6d(transformed_sensor_origin, octomath::Quaternion());
}
std::ofstream logfile;
if (detailedLog){
logfile.open((treeFilename+".log").c_str());
logfile << "# Memory of processing " << graphFilename << " over time\n";
logfile << "# Resolution: "<< res <<"; compression: " << int(compression) << "; scan endpoints: "<< num_points_in_graph << std::endl;
logfile << "# [scan number] [bytes octree] [bytes full 3D grid]\n";
}
cout << "\nCreating tree\n===========================\n";
OcTree* tree = new OcTree(res);
tree->setClampingThresMin(clampingMin);
tree->setClampingThresMax(clampingMax);
tree->setProbHit(probHit);
tree->setProbMiss(probMiss);
gettimeofday(&start, NULL); // start timer
unsigned int numScans = graph->size();
unsigned int currentScan = 1;
for (ScanGraph::iterator scan_it = graph->begin(); scan_it != graph->end(); scan_it++) {
if (max_scan_no > 0) cout << "("<<currentScan << "/" << max_scan_no << ") " << flush;
else cout << "("<<currentScan << "/" << numScans << ") " << flush;
if (simpleUpdate)
tree->insertPointCloudRays((*scan_it)->scan, (*scan_it)->pose.trans(), maxrange);
else
tree->insertPointCloud((*scan_it)->scan, (*scan_it)->pose.trans(), maxrange, false, discretize);
if (compression == 2){
tree->toMaxLikelihood();
tree->prune();
}
if (detailedLog)
logfile << currentScan << " " << tree->memoryUsage() << " " << tree->memoryFullGrid() << "\n";
if ((max_scan_no > 0) && (currentScan == (unsigned int) max_scan_no))
break;
currentScan++;
}
gettimeofday(&stop, NULL); // stop timer
double time_to_insert = (stop.tv_sec - start.tv_sec) + 1.0e-6 *(stop.tv_usec - start.tv_usec);
// get rid of graph in mem before doing anything fancy with tree (=> memory)
delete graph;
if (logfile.is_open())
logfile.close();
cout << "\nDone building tree.\n\n";
cout << "time to insert scans: " << time_to_insert << " sec" << endl;
cout << "time to insert 100.000 points took: " << time_to_insert/ ((double) num_points_in_graph / 100000) << " sec (avg)" << endl << endl;
std::cout << "Pruned tree (lossless compression)\n" << "===========================\n";
outputStatistics(tree);
tree->write(treeFilenameOT);
std::cout << "Pruned max-likelihood tree (lossy compression)\n" << "===========================\n";
tree->toMaxLikelihood();
tree->prune();
outputStatistics(tree);
cout << "\nWriting tree files\n===========================\n";
tree->write(treeFilenameMLOT);
std::cout << "Full Octree (pruned) written to "<< treeFilenameOT << std::endl;
std::cout << "Full Octree (max.likelihood, pruned) written to "<< treeFilenameMLOT << std::endl;
tree->writeBinary(treeFilename);
std::cout << "Bonsai tree written to "<< treeFilename << std::endl;
cout << endl;
delete tree;
exit(0);
}