本文整理汇总了C++中PointViewSet::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ PointViewSet::insert方法的具体用法?C++ PointViewSet::insert怎么用?C++ PointViewSet::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointViewSet
的用法示例。
在下文中一共展示了PointViewSet::insert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
PointViewSet PMFFilter::run(PointViewPtr input)
{
bool logOutput = log()->getLevel() > LogLevel::Debug1;
if (logOutput)
log()->floatPrecision(8);
log()->get(LogLevel::Debug2) << "Process PMFFilter...\n";
auto idx = processGround(input);
PointViewSet viewSet;
if (!idx.empty() && (m_classify || m_extract))
{
if (m_classify)
{
log()->get(LogLevel::Debug2) << "Labeled " << idx.size() << " ground returns!\n";
// set the classification label of ground returns as 2
// (corresponding to ASPRS LAS specification)
for (const auto& i : idx)
{
input->setField(Dimension::Id::Classification, i, 2);
}
viewSet.insert(input);
}
if (m_extract)
{
log()->get(LogLevel::Debug2) << "Extracted " << idx.size() << " ground returns!\n";
// create new PointView containing only ground returns
PointViewPtr output = input->makeNew();
for (const auto& i : idx)
{
output->appendPoint(*input, i);
}
viewSet.erase(input);
viewSet.insert(output);
}
}
else
{
if (idx.empty())
log()->get(LogLevel::Debug2) << "Filtered cloud has no ground returns!\n";
if (!(m_classify || m_extract))
log()->get(LogLevel::Debug2) << "Must choose --classify or --extract\n";
// return the input buffer unchanged
viewSet.insert(input);
}
return viewSet;
}
示例2: execute
PointViewSet Stage::execute(PointTableRef table)
{
//printf("called %s\n", this->classname());
log()->setLevel(LogLevel::Enum::Debug);
std::string cn(this->classname());
log()->setLeader(cn + " Stage::execute");
log()->get(LogLevel::Debug) << "Called by class " << std::endl;
table.layout()->finalize();
PointViewSet views;
if (m_inputs.empty())
{
log()->get(LogLevel::Debug) << "if block, class" << std::endl;
views.insert(PointViewPtr(new PointView(table)));
}
else
{
for (size_t i = 0; i < m_inputs.size(); ++i)
{
log()->get(LogLevel::Debug) << "block, class"
<< "input number "<< i << std::endl;
log()->get(LogLevel::Debug) << "if block, class" << std::endl;
Stage *prev = m_inputs[i];
PointViewSet temp = prev->execute(table);
views.insert(temp.begin(), temp.end());
}
}
PointViewSet outViews;
std::vector<StageRunnerPtr> runners;
ready(table);
for (auto const& it : views)
{
log()->get(LogLevel::Debug) << "run, class" << std::endl;
StageRunnerPtr runner(new StageRunner(this, it));
runners.push_back(runner);
runner->run();
}
for (auto const& it : runners)
{
log()->get(LogLevel::Debug) << "wait, class" << std::endl;
StageRunnerPtr runner(it);
PointViewSet temp = runner->wait();
outViews.insert(temp.begin(), temp.end());
}
l_done(table);
done(table);
return outViews;
}
示例3: run
PointViewSet SMRFilter::run(PointViewPtr view)
{
log()->get(LogLevel::Info) << "run: Process SMRFilter...\n";
std::vector<PointId> idx = processGround(view);
PointViewSet viewSet;
if (!idx.empty() && (m_classify || m_extract))
{
if (m_classify)
{
log()->get(LogLevel::Info) << "run: Labeled " << idx.size() << " ground returns!\n";
// set the classification label of ground returns as 2
// (corresponding to ASPRS LAS specification)
for (const auto& i : idx)
{
view->setField(Dimension::Id::Classification, i, 2);
}
viewSet.insert(view);
}
if (m_extract)
{
log()->get(LogLevel::Info) << "run: Extracted " << idx.size() << " ground returns!\n";
// create new PointView containing only ground returns
PointViewPtr output = view->makeNew();
for (const auto& i : idx)
{
output->appendPoint(*view, i);
}
viewSet.erase(view);
viewSet.insert(output);
}
}
else
{
if (idx.empty())
log()->get(LogLevel::Info) << "run: Filtered cloud has no ground returns!\n";
if (!(m_classify || m_extract))
log()->get(LogLevel::Info) << "run: Must choose --classify or --extract\n";
// return the view buffer unchanged
viewSet.insert(view);
}
return viewSet;
}
示例4: run
virtual PointViewSet run(PointViewPtr view)
{
PointViewSet out;
PointViewPtr v = view->makeNew();
for (PointId i = 0; i < view->size(); ++i)
{
if (i && (i % m_viewSize == 0))
{
out.insert(v);
v = v->makeNew();
}
v->appendPoint(*view, i);
}
out.insert(v);
return out;
}
示例5: COUNT
TEST(PointViewTest, order)
{
PointTable table;
const size_t COUNT(1000);
std::array<PointViewPtr, COUNT> views;
std::random_device dev;
std::mt19937 generator(dev());
for (size_t i = 0; i < COUNT; ++i)
views[i] = PointViewPtr(new PointView(table));
std::shuffle(views.begin(), views.end(), generator);
PointViewSet set;
for (size_t i = 0; i < COUNT; ++i)
set.insert(views[i]);
PointViewSet::iterator pi;
for (auto si = set.begin(); si != set.end(); ++si)
{
if (si != set.begin())
EXPECT_TRUE((*pi)->id() < (*si)->id());
pi = si;
}
}
示例6: run
PointViewSet PredicateFilter::run(PointViewPtr view)
{
MetadataNode n;
m_pythonMethod->resetArguments();
m_pythonMethod->begin(*view, n);
m_pythonMethod->execute();
if (!m_pythonMethod->hasOutputVariable("Mask"))
throw pdal::pdal_error("Mask variable not set in predicate "
"filter function.");
PointViewPtr outview = view->makeNew();
void *pydata =
m_pythonMethod->extractResult("Mask", Dimension::Type::Unsigned8);
char *ok = (char *)pydata;
for (PointId idx = 0; idx < view->size(); ++idx)
if (*ok++)
outview->appendPoint(*view, idx);
PointViewSet viewSet;
viewSet.insert(outview);
return viewSet;
}
示例7: run
PointViewSet LocateFilter::run(PointViewPtr inView)
{
PointViewSet viewSet;
if (!inView->size())
return viewSet;
PointId minidx, maxidx;
double minval = (std::numeric_limits<double>::max)();
double maxval = std::numeric_limits<double>::lowest();
for (PointId idx = 0; idx < inView->size(); idx++)
{
double val = inView->getFieldAs<double>(m_dimId, idx);
if (val > maxval)
{
maxval = val;
maxidx = idx;
}
if (val < minval)
{
minval = val;
minidx = idx;
}
}
PointViewPtr outView = inView->makeNew();
if (Utils::iequals("min", m_minmax))
outView->appendPoint(*inView.get(), minidx);
if (Utils::iequals("max", m_minmax))
outView->appendPoint(*inView.get(), maxidx);
viewSet.insert(outView);
return viewSet;
}
示例8: run
PointViewSet DecimationFilter::run(PointViewPtr inView)
{
PointViewSet viewSet;
PointViewPtr outView = inView->makeNew();
decimate(*inView.get(), *outView.get());
viewSet.insert(outView);
return viewSet;
}
示例9: run
PointViewSet run(PointViewPtr view)
{
if (m_count > view->size())
log()->get(LogLevel::Warning)
<< "Requested number of points (count=" << m_count
<< ") exceeds number of available points.\n";
PointViewSet viewSet;
PointViewPtr outView = view->makeNew();
for (PointId i = view->size() - std::min(m_count, view->size());
i < view->size(); ++i)
outView->appendPoint(*view, i);
viewSet.insert(outView);
return viewSet;
}
示例10: run
PointViewSet MergeFilter::run(PointViewPtr in)
{
PointViewSet viewSet;
// If the SRS of all the point views aren't the same, print a warning
// unless we're explicitly overriding the SRS.
if (getSpatialReference().empty() &&
(in->spatialReference() != m_view->spatialReference()))
log()->get(LogLevel::Warning) << getName() << ": merging points "
"with inconsistent spatial references." << std::endl;
m_view->append(*in.get());
viewSet.insert(m_view);
return viewSet;
}
示例11: layout
TEST(PointViewTest, calcBounds)
{
auto set_points = [](PointViewPtr view, PointId i, double x, double y,
double z)
{
view->setField(Dimension::Id::X, i, x);
view->setField(Dimension::Id::Y, i, y);
view->setField(Dimension::Id::Z, i, z);
};
PointTable table;
PointLayoutPtr layout(table.layout());
layout->registerDim(Dimension::Id::X);
layout->registerDim(Dimension::Id::Y);
layout->registerDim(Dimension::Id::Z);
const double lim_min = (std::numeric_limits<double>::lowest)();
const double lim_max = (std::numeric_limits<double>::max)();
PointViewPtr b0(new PointView(table));
BOX3D box_b0;
b0->calculateBounds(box_b0);
check_bounds(box_b0, lim_max, lim_min, lim_max, lim_min, lim_max, lim_min);
PointViewPtr b1(new PointView(table));
set_points(b1, 0, 0.0, 0.0, 0.0);
set_points(b1, 1, 2.0, 2.0, 2.0);
PointViewPtr b2(new PointView(table));
set_points(b2, 0, 3.0, 3.0, 3.0);
set_points(b2, 1, 1.0, 1.0, 1.0);
PointViewSet bs;
bs.insert(b1);
bs.insert(b2);
BOX3D box_b1;
b1->calculateBounds(box_b1);
check_bounds(box_b1, 0.0, 2.0, 0.0, 2.0, 0.0, 2.0);
BOX3D box_b2;
b2->calculateBounds(box_b2);
check_bounds(box_b2, 1.0, 3.0, 1.0, 3.0, 1.0, 3.0);
BOX3D box_bs;
PointView::calculateBounds(bs, box_bs);
check_bounds(box_bs, 0.0, 3.0, 0.0, 3.0, 0.0, 3.0);
}
示例12: run
PointViewSet SampleFilter::run(PointViewPtr inView)
{
point_count_t np = inView->size();
// Return empty PointViewSet if the input PointView has no points.
// Otherwise, make a new output PointView.
PointViewSet viewSet;
if (!np)
return viewSet;
PointViewPtr outView = inView->makeNew();
// Build the 3D KD-tree.
KD3Index index(*inView);
index.build();
// All points are marked as kept (1) by default. As they are masked by
// neighbors within the user-specified radius, their value is changed to 0.
std::vector<int> keep(np, 1);
// We are able to subsample in a single pass over the shuffled indices.
for (PointId i = 0; i < np; ++i)
{
// If a point is masked, it is forever masked, and cannot be part of the
// sampled cloud. Otherwise, the current index is appended to the output
// PointView.
if (keep[i] == 0)
continue;
outView->appendPoint(*inView, i);
// We now proceed to mask all neighbors within m_radius of the kept
// point.
auto ids = index.radius(i, m_radius);
for (auto const& id : ids)
keep[id] = 0;
}
// Simply calculate the percentage of retained points.
double frac = (double)outView->size() / (double)inView->size();
log()->get(LogLevel::Debug2)
<< "Retaining " << outView->size() << " of " << inView->size()
<< " points (" << 100 * frac << "%)\n";
viewSet.insert(outView);
return viewSet;
}
示例13: run
PointViewSet RangeFilter::run(PointViewPtr inView)
{
PointViewSet viewSet;
if (!inView->size())
return viewSet;
PointViewPtr outView = inView->makeNew();
for (PointId i = 0; i < inView->size(); ++i)
{
PointRef point = inView->point(i);
if (processOne(point))
outView->appendPoint(*inView, i);
}
viewSet.insert(outView);
return viewSet;
}
示例14: run
PointViewSet GroupByFilter::run(PointViewPtr inView)
{
PointViewSet viewSet;
if (!inView->size())
return viewSet;
for (PointId idx = 0; idx < inView->size(); idx++)
{
uint64_t val = inView->getFieldAs<uint64_t>(m_dimId, idx);
PointViewPtr& outView = m_viewMap[val];
if (!outView)
outView = inView->makeNew();
outView->appendPoint(*inView.get(), idx);
}
// Pull the buffers out of the map and stick them in the standard
// output set.
for (auto bi = m_viewMap.begin(); bi != m_viewMap.end(); ++bi)
viewSet.insert(bi->second);
return viewSet;
}
示例15: run
PointViewSet StatisticalOutlierFilter::run(PointViewPtr input)
{
bool logOutput = log()->getLevel() > LogLevel::Debug1;
if (logOutput)
log()->floatPrecision(8);
log()->get(LogLevel::Debug2) << "Process StatisticalOutlierFilter...\n";
// convert PointView to PointXYZ
typedef pcl::PointCloud<pcl::PointXYZ> Cloud;
Cloud::Ptr cloud(new Cloud);
BOX3D bounds;
input->calculateBounds(bounds);
pclsupport::PDALtoPCD(input, *cloud, bounds);
// PCL should provide console output at similar verbosity level as PDAL
int level = log()->getLevel();
switch (level)
{
case 0:
pcl::console::setVerbosityLevel(pcl::console::L_ALWAYS);
break;
case 1:
pcl::console::setVerbosityLevel(pcl::console::L_ERROR);
break;
case 2:
pcl::console::setVerbosityLevel(pcl::console::L_WARN);
break;
case 3:
pcl::console::setVerbosityLevel(pcl::console::L_INFO);
break;
case 4:
pcl::console::setVerbosityLevel(pcl::console::L_DEBUG);
break;
default:
pcl::console::setVerbosityLevel(pcl::console::L_VERBOSE);
break;
}
// setup the outlier filter
pcl::StatisticalOutlierRemoval<pcl::PointXYZ> sor(true);
sor.setInputCloud(cloud);
sor.setMeanK(m_meanK);
sor.setStddevMulThresh(m_multiplier);
pcl::PointCloud<pcl::PointXYZ> output;
sor.setNegative(true);
sor.filter(output);
// filtered to return inliers
pcl::PointIndicesPtr inliers(new pcl::PointIndices);
sor.getRemovedIndices(*inliers);
log()->get(LogLevel::Debug2) << inliers->indices.size() << std::endl;
PointViewSet viewSet;
if (inliers->indices.empty())
{
log()->get(LogLevel::Warning) << "Requested filter would remove all points. Try increasing the multiplier.\n";
viewSet.insert(input);
return viewSet;
}
// inverse are the outliers
std::vector<int> outliers(input->size()-inliers->indices.size());
for (PointId i = 0, j = 0, k = 0; i < input->size(); ++i)
{
if (i == (PointId)inliers->indices[j])
{
j++;
continue;
}
outliers[k++] = i;
}
if (!outliers.empty() && (m_classify || m_extract))
{
if (m_classify)
{
log()->get(LogLevel::Debug2) << "Labeled " << outliers.size() << " outliers as noise!\n";
// set the classification label of outlier returns as 18
// (corresponding to ASPRS LAS specification for high noise)
for (const auto& i : outliers)
{
input->setField(Dimension::Id::Classification, i, 18);
}
viewSet.insert(input);
}
if (m_extract)
{
log()->get(LogLevel::Debug2) << "Extracted " << inliers->indices.size() << " inliers!\n";
// create new PointView containing only outliers
PointViewPtr output = input->makeNew();
for (const auto& i : inliers->indices)
{
output->appendPoint(*input, i);
//.........这里部分代码省略.........