本文整理汇总了C++中typenamepcl::PointCloud类的典型用法代码示例。如果您正苦于以下问题:C++ PointCloud类的具体用法?C++ PointCloud怎么用?C++ PointCloud使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PointCloud类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: inputCloud
void VoxelGrid::inputCloud(typename pcl::PointCloud<PointT>::ConstPtr cloud)
{
double res = readParameter<double>("resolution");
Eigen::Vector4f leaf(res, res, res, 0);
typename pcl::PointCloud<PointT>::Ptr out(new pcl::PointCloud<PointT>);
typename pcl::PointCloud<PointT>::ConstPtr in;
if (remove_nan_) {
typename pcl::PointCloud<PointT>::Ptr tmp(new pcl::PointCloud<PointT>);
tmp->points.reserve(cloud->points.size());
for (auto it = cloud->begin(); it != cloud->end(); ++it) {
if (!std::isnan(it->x)) {
tmp->points.push_back(*it);
}
}
in = tmp;
} else {
in = cloud;
}
pcl::VoxelGrid<PointT> voxel_f;
voxel_f.setInputCloud(in);
voxel_f.setLeafSize(leaf);
voxel_f.filter(*out);
PointCloudMessage::Ptr msg(new PointCloudMessage(cloud->header.frame_id, cloud->header.stamp));
out->header = cloud->header;
msg->value = out;
msg::publish(output_, msg);
}
开发者ID:cogsys-tuebingen,项目名称:csapex_core_plugins,代码行数:35,代码来源:voxel_grid.cpp
示例2: cropCloud
void WorldDownloadManager::cropCloud(const Eigen::Vector3f & min,const Eigen::Vector3f & max,
typename pcl::PointCloud<PointT>::ConstPtr cloud,typename pcl::PointCloud<PointT>::Ptr out_cloud)
{
const uint cloud_size = cloud->size();
std::vector<bool> valid_points(cloud_size,true);
// check the points
for (uint i = 0; i < cloud_size; i++)
{
const PointT & pt = (*cloud)[i];
if (pt.x > max.x() || pt.y > max.y() || pt.z > max.z() ||
pt.x < min.x() || pt.y < min.y() || pt.z < min.z())
valid_points[i] = false;
}
// discard invalid points
out_cloud->clear();
out_cloud->reserve(cloud_size);
uint count = 0;
for (uint i = 0; i < cloud_size; i++)
if (valid_points[i])
{
out_cloud->push_back((*cloud)[i]);
count++;
}
out_cloud->resize(count);
}
开发者ID:CURG,项目名称:ros_kinfu,代码行数:30,代码来源:worlddownloadutils.cpp
示例3: cropCloudWithSphere
void WorldDownloadManager::cropCloudWithSphere(const Eigen::Vector3f & center,const float radius,
typename pcl::PointCloud<PointT>::ConstPtr cloud,typename pcl::PointCloud<PointT>::Ptr out_cloud)
{
const uint cloud_size = cloud->size();
std::vector<bool> valid_points(cloud_size,true);
// check the points
for (uint i = 0; i < cloud_size; i++)
{
const PointT & pt = (*cloud)[i];
const Eigen::Vector3f ept(pt.x,pt.y,pt.z);
if ((ept - center).squaredNorm() > radius * radius)
valid_points[i] = false;
}
// discard invalid points
out_cloud->clear();
out_cloud->reserve(cloud_size);
uint count = 0;
for (uint i = 0; i < cloud_size; i++)
if (valid_points[i])
{
out_cloud->push_back((*cloud)[i]);
count++;
}
out_cloud->resize(count);
}
开发者ID:CURG,项目名称:ros_kinfu,代码行数:30,代码来源:worlddownloadutils.cpp
示例4: acosf
template<typename PointT> void
pcl::approximatePolygon (const PlanarPolygon<PointT>& polygon, PlanarPolygon<PointT>& approx_polygon, float threshold, bool refine, bool closed)
{
const Eigen::Vector4f& coefficients = polygon.getCoefficients ();
const typename pcl::PointCloud<PointT>::VectorType &contour = polygon.getContour ();
Eigen::Vector3f rotation_axis (coefficients[1], -coefficients[0], 0.0f);
rotation_axis.normalize ();
float rotation_angle = acosf (coefficients [2]);
Eigen::Affine3f transformation = Eigen::Translation3f (0, 0, coefficients [3]) * Eigen::AngleAxisf (rotation_angle, rotation_axis);
typename pcl::PointCloud<PointT>::VectorType polygon2D (contour.size ());
for (unsigned pIdx = 0; pIdx < polygon2D.size (); ++pIdx)
polygon2D [pIdx].getVector3fMap () = transformation * contour [pIdx].getVector3fMap ();
typename pcl::PointCloud<PointT>::VectorType approx_polygon2D;
approximatePolygon2D<PointT> (polygon2D, approx_polygon2D, threshold, refine, closed);
typename pcl::PointCloud<PointT>::VectorType &approx_contour = approx_polygon.getContour ();
approx_contour.resize (approx_polygon2D.size ());
Eigen::Affine3f inv_transformation = transformation.inverse ();
for (unsigned pIdx = 0; pIdx < approx_polygon2D.size (); ++pIdx)
approx_contour [pIdx].getVector3fMap () = inv_transformation * approx_polygon2D [pIdx].getVector3fMap ();
}
开发者ID:lloves,项目名称:PCL-1,代码行数:26,代码来源:polygon_operations.hpp
示例5: observation_transformed
void
MultiviewRecognizerWithChangeDetection<PointT>::reconstructionFiltering(typename pcl::PointCloud<PointT>::Ptr observation,
pcl::PointCloud<pcl::Normal>::Ptr observation_normals, const Eigen::Matrix4f &absolute_pose, size_t view_id) {
CloudPtr observation_transformed(new Cloud);
pcl::transformPointCloud(*observation, *observation_transformed, absolute_pose);
CloudPtr cloud_tmp(new Cloud);
std::vector<int> indices;
v4r::ChangeDetector<PointT>::difference(observation_transformed, removed_points_cumulated_history_[view_id],
cloud_tmp, indices, param_.tolerance_for_cloud_diff_);
/* Visualization of changes removal for reconstruction:
Cloud rec_changes;
rec_changes += *cloud_transformed;
v4r::VisualResultsStorage::copyCloudColored(*removed_points_cumulated_history_[view_id], rec_changes, 255, 0, 0);
v4r::VisualResultsStorage::copyCloudColored(*cloud_tmp, rec_changes, 200, 0, 200);
stringstream ss;
ss << view_id;
visResStore.savePcd("reconstruction_changes_" + ss.str(), rec_changes);*/
std::vector<bool> preserved_mask(observation->size(), false);
for (std::vector<int>::iterator i = indices.begin(); i < indices.end(); i++) {
preserved_mask[*i] = true;
}
for (size_t j = 0; j < preserved_mask.size(); j++) {
if (!preserved_mask[j]) {
setNan(observation->at(j));
setNan(observation_normals->at(j));
}
}
PCL_INFO("Points by change detection removed: %d\n", observation->size() - indices.size());
}
开发者ID:martin-velas,项目名称:v4r,代码行数:31,代码来源:multiview_object_recognizer_change_detection.hpp
示例6: projectCloudOnXYPlane
void projectCloudOnXYPlane(
typename pcl::PointCloud<PointT>::Ptr & cloud)
{
for(unsigned int i=0; i<cloud->size(); ++i)
{
cloud->at(i).z = 0;
}
}
开发者ID:abdullah38rcc,项目名称:rtabmap,代码行数:8,代码来源:util3d.hpp
示例7: octree
template <typename PointInT, typename PointNT, typename PointOutT> void
pcl::GFPFHEstimation<PointInT, PointNT, PointOutT>::computeFeature (PointCloudOut &output)
{
pcl::octree::OctreePointCloudSearch<PointInT> octree (octree_leaf_size_);
octree.setInputCloud (input_);
octree.addPointsFromInputCloud ();
typename pcl::PointCloud<PointInT>::VectorType occupied_cells;
octree.getOccupiedVoxelCenters (occupied_cells);
// Determine the voxels crosses along the line segments
// formed by every pair of occupied cells.
std::vector< std::vector<int> > line_histograms;
for (size_t i = 0; i < occupied_cells.size (); ++i)
{
Eigen::Vector3f origin = occupied_cells[i].getVector3fMap ();
for (size_t j = i+1; j < occupied_cells.size (); ++j)
{
typename pcl::PointCloud<PointInT>::VectorType intersected_cells;
Eigen::Vector3f end = occupied_cells[j].getVector3fMap ();
octree.getApproxIntersectedVoxelCentersBySegment (origin, end, intersected_cells, 0.5f);
// Intersected cells are ordered from closest to furthest w.r.t. the origin.
std::vector<int> histogram;
for (size_t k = 0; k < intersected_cells.size (); ++k)
{
std::vector<int> indices;
octree.voxelSearch (intersected_cells[k], indices);
int label = emptyLabel ();
if (indices.size () != 0)
{
label = getDominantLabel (indices);
}
histogram.push_back (label);
}
line_histograms.push_back(histogram);
}
}
std::vector< std::vector<int> > transition_histograms;
computeTransitionHistograms (line_histograms, transition_histograms);
std::vector<float> distances;
computeDistancesToMean (transition_histograms, distances);
std::vector<float> gfpfh_histogram;
computeDistanceHistogram (distances, gfpfh_histogram);
output.clear ();
output.width = 1;
output.height = 1;
output.points.resize (1);
std::copy (gfpfh_histogram.begin (), gfpfh_histogram.end (), output.points[0].histogram);
}
开发者ID:KaiwenGuo,项目名称:pcl,代码行数:56,代码来源:gfpfh.hpp
示例8: trim_Z
inline void trim_Z(boost::shared_ptr<pcl::PointCloud<PointT>> &cloud, double zrange_min, double zrange_max) {
typename pcl::PointCloud<PointT>::Ptr cloud_filtered_pass (new pcl::PointCloud<PointT>(512, 424));
pcl::PassThrough<pcl::PointXYZRGB> pass;
pass.setInputCloud(cloud);
pass.setFilterFieldName("z");
pass.setFilterLimits(-zrange_max, -zrange_min);
pass.filter (*cloud_filtered_pass);
cloud_filtered_pass.swap (cloud);
}
开发者ID:tangible-landscape,项目名称:r.in.kinect,代码行数:10,代码来源:main.cpp
示例9: rotate_Z
inline void rotate_Z(boost::shared_ptr<pcl::PointCloud<PointT>> &cloud, double angle) {
Eigen::Affine3f transform_Z = Eigen::Affine3f::Identity();
// The same rotation matrix as before; tetha radians arround Z axis
transform_Z.rotate (Eigen::AngleAxisf (angle, Eigen::Vector3f::UnitZ()));
// Executing the transformation
typename pcl::PointCloud<PointT>::Ptr transformed_cloud (new pcl::PointCloud<PointT>(512, 424));
pcl::transformPointCloud (*cloud, *transformed_cloud, transform_Z);
transformed_cloud.swap (cloud);
}
开发者ID:tangible-landscape,项目名称:r.in.kinect,代码行数:11,代码来源:main.cpp
示例10:
template <typename PointT> void
pcl::SupervoxelClustering<PointT>::SupervoxelHelper::getNormals (typename pcl::PointCloud<Normal>::Ptr &normals) const
{
normals.reset (new pcl::PointCloud<Normal>);
normals->clear ();
normals->resize (leaves_.size ());
typename SupervoxelHelper::const_iterator leaf_itr;
typename pcl::PointCloud<Normal>::iterator normal_itr = normals->begin ();
for (leaf_itr = leaves_.begin (); leaf_itr != leaves_.end (); ++leaf_itr, ++normal_itr)
{
const VoxelData& leaf_data = (*leaf_itr)->getData ();
leaf_data.getNormal (*normal_itr);
}
}
开发者ID:4ker,项目名称:pcl,代码行数:14,代码来源:supervoxel_clustering.hpp
示例11: publishPointCloud
void SurfelMapPublisher::publishPointCloud(const boost::shared_ptr<MapType>& map)
{
if (m_pointCloudPublisher.getNumSubscribers() == 0)
return;
typename pcl::PointCloud<PointType>::Ptr cellPointsCloud(new pcl::PointCloud<PointType>());
map->lock();
map->getCellPoints(cellPointsCloud);
map->unlock();
cellPointsCloud->header.frame_id = map->getFrameId();
cellPointsCloud->header.stamp = pcl_conversions::toPCL(map->getLastUpdateTimestamp());
m_pointCloudPublisher.publish(cellPointsCloud);
ROS_DEBUG_STREAM("publishing cell points: " << cellPointsCloud->size());
}
开发者ID:AIS-Bonn,项目名称:mrs_laser_map,代码行数:14,代码来源:surfelmap_publisher.hpp
示例12:
template <typename PointT> void
pcl::SupervoxelClustering<PointT>::SupervoxelHelper::getNormals (typename pcl::PointCloud<Normal>::Ptr &normals) const
{
normals = boost::make_shared<pcl::PointCloud<Normal> > ();
normals->clear ();
normals->resize (leaves_.size ());
typename std::set<LeafContainerT*>::iterator leaf_itr;
typename pcl::PointCloud<Normal>::iterator normal_itr = normals->begin ();
for (leaf_itr = leaves_.begin (); leaf_itr != leaves_.end (); ++leaf_itr, ++normal_itr)
{
const VoxelData& leaf_data = (*leaf_itr)->getData ();
leaf_data.getNormal (*normal_itr);
}
}
开发者ID:FBIKKIBF,项目名称:pcl,代码行数:14,代码来源:supervoxel_clustering.hpp
示例13:
template <typename PointT> void
pcl::SupervoxelClustering<PointT>::SupervoxelHelper::getVoxels (typename pcl::PointCloud<PointT>::Ptr &voxels) const
{
voxels = boost::make_shared<pcl::PointCloud<PointT> > ();
voxels->clear ();
voxels->resize (leaves_.size ());
typename pcl::PointCloud<PointT>::iterator voxel_itr = voxels->begin ();
//typename std::set<LeafContainerT*>::iterator leaf_itr;
for (typename std::set<LeafContainerT*>::const_iterator leaf_itr = leaves_.begin ();
leaf_itr != leaves_.end ();
++leaf_itr, ++voxel_itr)
{
const VoxelData& leaf_data = (*leaf_itr)->getData ();
leaf_data.getPoint (*voxel_itr);
}
}
开发者ID:Cakem1x,项目名称:pcl,代码行数:16,代码来源:supervoxel_clustering.hpp
示例14: return
template <typename T> bool
pcl::visualization::ImageViewer::addMask (
const typename pcl::PointCloud<T>::ConstPtr &image,
const pcl::PointCloud<T> &mask,
double r, double g, double b,
const std::string &layer_id, double opacity)
{
// We assume that the data passed into image is organized, otherwise this doesn't make sense
if (!image->isOrganized ())
return (false);
// Check to see if this ID entry already exists (has it been already added to the visualizer?)
LayerMap::iterator am_it = std::find_if (layer_map_.begin (), layer_map_.end (), LayerComparator (layer_id));
if (am_it == layer_map_.end ())
{
PCL_DEBUG ("[pcl::visualization::ImageViewer::addMask] No layer with ID'=%s' found. Creating new one...\n", layer_id.c_str ());
am_it = createLayer (layer_id, image_viewer_->GetRenderWindow ()->GetSize ()[0] - 1, image_viewer_->GetRenderWindow ()->GetSize ()[1] - 1, opacity, true);
}
am_it->canvas->SetDrawColor (r * 255.0, g * 255.0, b * 255.0, opacity * 255.0);
// Construct a search object to get the camera parameters
pcl::search::OrganizedNeighbor<T> search;
search.setInputCloud (image);
for (size_t i = 0; i < mask.points.size (); ++i)
{
pcl::PointXY p_projected;
search.projectPoint (mask.points[i], p_projected);
am_it->canvas->DrawPoint (int (p_projected.x),
int (float (image->height) - p_projected.y));
}
return (true);
}
开发者ID:TuZZiX,项目名称:ROS_IDE_inc,代码行数:35,代码来源:image_viewer.hpp
示例15: colorize
static bool colorize(const typename pcl::PointCloud<PointTypeIn>& iCloud,
const Eigen::Affine3d& iCloudToCamera,
const bot_core::image_t& iImage,
const BotCamTrans* iCamTrans,
typename pcl::PointCloud<PointTypeOut>& oCloud) {
pcl::copyPointCloud(iCloud, oCloud);
pcl::PointCloud<PointTypeOut> tempCloud;
pcl::transformPointCloud(iCloud, tempCloud, iCloudToCamera.cast<float>());
int numPoints = iCloud.size();
for (int i = 0; i < numPoints; ++i) {
double p[3] = {tempCloud[i].x, tempCloud[i].y, tempCloud[i].z};
double pix[3];
bot_camtrans_project_point(iCamTrans, p, pix);
oCloud[i].r = oCloud[i].g = oCloud[i].b = 0;
if (pix[2] < 0) {
continue;
}
uint8_t r, g, b;
if (interpolate(pix[0], pix[1], iImage, r, g, b)) {
oCloud[i].r = r;
oCloud[i].g = g;
oCloud[i].b = b;
}
}
return true;
}
开发者ID:andybarry,项目名称:pronto,代码行数:29,代码来源:filter_colorize.hpp
示例16: clipNSEW
inline void clipNSEW(boost::shared_ptr<pcl::PointCloud<PointT>> &cloud, double clip_N, double clip_S, double clip_E, double clip_W) {
typename pcl::PointCloud<PointT>::Ptr cloud_filtered_pass (new pcl::PointCloud<PointT>(512, 424));
pcl::PassThrough<PointT> pass;
pass.setInputCloud(cloud);
pass.setFilterFieldName("x");
pass.setFilterLimits(-clip_W, clip_E);
pass.filter (*cloud_filtered_pass);
cloud_filtered_pass.swap (cloud);
pass.setInputCloud(cloud);
pass.setFilterFieldName("y");
pass.setFilterLimits(-clip_S, clip_N);
pass.filter (*cloud_filtered_pass);
cloud_filtered_pass.swap (cloud);
}
开发者ID:tangible-landscape,项目名称:r.in.kinect,代码行数:16,代码来源:main.cpp
示例17: ids
template <typename PointT> inline float
pcl::getMeanPointDensity (const typename pcl::PointCloud<PointT>::ConstPtr &cloud, float max_dist, int nr_threads)
{
const float max_dist_sqr = max_dist * max_dist;
const std::size_t s = cloud.size ();
pcl::search::KdTree <PointT> tree;
tree.setInputCloud (cloud);
float mean_dist = 0.f;
int num = 0;
std::vector <int> ids (2);
std::vector <float> dists_sqr (2);
#ifdef _OPENMP
#pragma omp parallel for \
reduction (+:mean_dist, num) \
private (ids, dists_sqr) shared (tree, cloud) \
default (none)num_threads (nr_threads)
#endif
for (int i = 0; i < 1000; i++)
{
tree.nearestKSearch (cloud->points[rand () % s], 2, ids, dists_sqr);
if (dists_sqr[1] < max_dist_sqr)
{
mean_dist += std::sqrt (dists_sqr[1]);
num++;
}
}
return (mean_dist / num);
};
开发者ID:butten,项目名称:pcl,代码行数:33,代码来源:ia_fpcs.hpp
示例18: radiusFiltering
pcl::IndicesPtr radiusFiltering(
const typename pcl::PointCloud<PointT>::Ptr & cloud,
const pcl::IndicesPtr & indices,
float radiusSearch,
int minNeighborsInRadius)
{
typedef typename pcl::search::KdTree<PointT> KdTree;
typedef typename KdTree::Ptr KdTreePtr;
KdTreePtr tree (new KdTree(false));
if(indices->size())
{
pcl::IndicesPtr output(new std::vector<int>(indices->size()));
int oi = 0; // output iterator
tree->setInputCloud(cloud, indices);
for(unsigned int i=0; i<indices->size(); ++i)
{
std::vector<int> kIndices;
std::vector<float> kDistances;
int k = tree->radiusSearch(cloud->at(indices->at(i)), radiusSearch, kIndices, kDistances);
if(k > minNeighborsInRadius)
{
output->at(oi++) = indices->at(i);
}
}
output->resize(oi);
return output;
}
else
{
pcl::IndicesPtr output(new std::vector<int>(cloud->size()));
int oi = 0; // output iterator
tree->setInputCloud(cloud);
for(unsigned int i=0; i<cloud->size(); ++i)
{
std::vector<int> kIndices;
std::vector<float> kDistances;
int k = tree->radiusSearch(cloud->at(i), radiusSearch, kIndices, kDistances);
if(k > minNeighborsInRadius)
{
output->at(oi++) = i;
}
}
output->resize(oi);
return output;
}
}
开发者ID:abdullah38rcc,项目名称:rtabmap,代码行数:47,代码来源:util3d.hpp
示例19: boxMask
VectorXb boxMask(typename pcl::PointCloud<T>::ConstPtr in, float xmin, float ymin, float zmin, float xmax, float ymax, float zmax) {
int i=0;
VectorXb out(in->size());
BOOST_FOREACH(const T& pt, in->points) {
out[i] = (pt.x >= xmin && pt.x <= xmax && pt.y >= ymin && pt.y <= ymax && pt.z >= zmin && pt.z <= zmax);
++i;
}
return out;
}
开发者ID:bryongloden,项目名称:trajopt,代码行数:9,代码来源:cloudproc.cpp
示例20: trimNSEW
inline void trimNSEW(boost::shared_ptr<pcl::PointCloud<PointT>> &cloud, double trim_N, double trim_S, double trim_E, double trim_W) {
struct bound_box bbox;
typename pcl::PointCloud<PointT>::Ptr cloud_filtered_pass (new pcl::PointCloud<PointT>(512, 424));
getMinMax(*cloud, bbox);
pcl::PassThrough<PointT> pass;
pass.setInputCloud(cloud);
pass.setFilterFieldName("x");
pass.setFilterLimits(bbox.W + trim_W, bbox.E - trim_E);
pass.filter (*cloud_filtered_pass);
cloud_filtered_pass.swap (cloud);
pass.setInputCloud(cloud);
pass.setFilterFieldName("y");
pass.setFilterLimits(bbox.S + trim_S, bbox.N - trim_N);
pass.filter (*cloud_filtered_pass);
cloud_filtered_pass.swap (cloud);
}
开发者ID:tangible-landscape,项目名称:r.in.kinect,代码行数:18,代码来源:main.cpp
注:本文中的typenamepcl::PointCloud类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论