本文整理汇总了C++中Trajectory::get方法的典型用法代码示例。如果您正苦于以下问题:C++ Trajectory::get方法的具体用法?C++ Trajectory::get怎么用?C++ Trajectory::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Trajectory
的用法示例。
在下文中一共展示了Trajectory::get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buildMap
Cloud::Ptr SlamCalibrator::buildMap(StreamSequenceBase::ConstPtr sseq, const Trajectory& traj, double max_range, double vgsize)
{
std::cout<<"Building slam calibration map using max range of " << max_range << std::endl;
Cloud::Ptr map(new Cloud);
int num_used_frames = 0;
for(size_t i = 0; i < traj.size(); ++i) {
if(!traj.exists(i))
continue;
// if(i % traj.size() / 10 == 0)
// cout << "." << flush;
Frame frame;
sseq->readFrame(i, &frame);
filterFringe(&frame);
Cloud::Ptr tmp(new Cloud);
sseq->proj_.frameToCloud(frame, tmp.get(), max_range);
Cloud::Ptr nonans(new Cloud);
nonans->reserve(tmp->size());
for(size_t j = 0; j < tmp->size(); ++j)
if(isFinite(tmp->at(j)))
nonans->push_back(tmp->at(j));
pcl::transformPointCloud(*nonans, *nonans, traj.get(i).cast<float>());
*map += *nonans;
++num_used_frames;
// Added intermediate filtering to handle memory overload on huge maps
if(num_used_frames % 50 == 0)
{
//cout << "Filtering..." << endl;
HighResTimer hrt("filtering");
hrt.start();
pcl::VoxelGrid<Point> vg;
vg.setLeafSize(vgsize, vgsize, vgsize);
Cloud::Ptr tmp(new Cloud);
vg.setInputCloud(map);
vg.filter(*tmp);
*map = *tmp;
hrt.stop();
}
}
//cout << endl;
//cout << "Filtering..." << endl;
HighResTimer hrt("filtering");
hrt.start();
pcl::VoxelGrid<Point> vg;
vg.setLeafSize(vgsize, vgsize, vgsize);
Cloud::Ptr tmp(new Cloud);
vg.setInputCloud(map);
vg.filter(*tmp);
*map = *tmp;
hrt.stop();
//cout << hrt.reportMilliseconds() << endl;
cout << "Filtered map has " << map->size() << " points." << endl;
return map;
}
示例2: processMap
size_t SlamCalibrator::processMap(const StreamSequenceBase& sseq,
const Trajectory& traj, const Cloud& map,
DiscreteDepthDistortionModel* model) const
{
// -- Select which frame indices from the sequence to use.
// Consider only those with a pose in the Trajectory,
// and apply downsampling based on increment_.
vector<size_t> indices;
indices.reserve(traj.numValid());
int num = 0;
for(size_t i = 0; i < traj.size(); ++i) {
if(traj.exists(i)) {
++num;
if(num % increment_ == 0)
indices.push_back(i);
}
}
// -- For all selected frames, accumulate training examples
// in the distortion model.
VectorXi counts = VectorXi::Zero(indices.size());
#pragma omp parallel for
for(size_t i = 0; i < indices.size(); ++i) {
size_t idx = indices[i];
BOOST_ASSERT(traj.exists(idx));
cout << "." << flush;
Frame measurement;
sseq.readFrame(idx, &measurement);
Frame mapframe;
mapframe.depth_ = DepthMatPtr(new DepthMat);
sseq.proj_.estimateMapDepth(map, traj.get(idx).inverse().cast<float>(),
measurement, mapframe.depth_.get());
counts[i] = model->accumulate(*mapframe.depth_, *measurement.depth_);
// cv::imshow("map", mapframe.depthImage());
// cv::imshow("measurement", measurement.depthImage());
// cv::waitKey();
// -- Quick and dirty option for data inspection.
if(getenv("U") && getenv("V")) {
int u_center = atoi(getenv("U"));
int v_center = atoi(getenv("V"));
int radius = 1;
for(int u = max(0, u_center - radius); u < min(640, u_center + radius + 1); ++u) {
for(int v = max(0, v_center - radius); v < min(480, v_center + radius + 1); ++v) {
if(mapframe.depth_->coeffRef(v, u) == 0)
continue;
if(measurement.depth_->coeffRef(v, u) == 0)
continue;
cerr << mapframe.depth_->coeffRef(v, u) * 0.001
<< " "
<< measurement.depth_->coeffRef(v, u) * 0.001
<< endl;
}
}
}
}
cout << endl;
return counts.sum();
}