38 #ifndef PCL_GPU_FEATURES_TEST_DATA_SOURCE_HPP_
39 #define PCL_GPU_FEATURES_TEST_DATA_SOURCE_HPP_
44 #include <pcl/point_cloud.h>
45 #include <pcl/io/pcd_io.h>
47 #include <pcl/features/normal_3d.h>
48 #include <pcl/visualization/cloud_viewer.h>
49 #include <pcl/gpu/containers/kernel_containers.h>
50 #include <pcl/search/search.h>
52 #include <Eigen/StdVector>
54 #if defined (_WIN32) || defined(_WIN64)
67 const static int k = 32;
82 DataSource(
const std::string& file =
"d:/office_chair_model.pcd")
91 float sz = (maxp.x - minp.x + maxp.y - minp.y + maxp.z - minp.z) / 3;
99 int r = std::max(1, std::min(255,
static_cast<int>((
double(rand())/RAND_MAX)*255)));
100 int g = std::max(1, std::min(255,
static_cast<int>((
double(rand())/RAND_MAX)*255)));
101 int b = std::max(1, std::min(255,
static_cast<int>((
double(rand())/RAND_MAX)*255)));
103 *
reinterpret_cast<int*
>(&p.data[3]) = (b << 16) + (g << 8) + r;
130 const auto cloud_size =
cloud->size();
132 std::vector<float> dists;
134 for(std::size_t i = 0; i < cloud_size; ++i)
149 const auto cloud_size =
cloud->size();
151 std::vector<float> dists;
153 for(std::size_t i = 0; i < cloud_size; ++i)
172 for(std::size_t i = 0; i <
cloud->size(); i+= 10)
180 for(std::size_t i = 0; i <
normals->size(); i+= 10)
191 for(std::size_t i = 0; i <
cloud->size(); i += step)
void setKSearch(int k)
Set the number of k nearest neighbors to use for the feature estimation.
void setSearchMethod(const KdTreePtr &tree)
Provide a pointer to the search object.
void compute(PointCloudOut &output)
Base method for feature estimation for all points given in <setInputCloud (), setIndices ()> using th...
KdTreeFLANN is a generic type of 3D spatial locator using kD-tree structures.
shared_ptr< KdTreeFLANN< PointT, Dist > > Ptr
int nearestKSearch(const PointT &point, unsigned int k, Indices &k_indices, std::vector< float > &k_sqr_distances) const override
Search for k-nearest neighbors for the given query point.
int radiusSearch(const PointT &point, double radius, Indices &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) const override
Search for all the nearest neighbors of the query point in a given radius.
void setInputCloud(const PointCloudConstPtr &cloud, const IndicesConstPtr &indices=IndicesConstPtr()) override
Provide a pointer to the input dataset.
NormalEstimation estimates local surface properties (surface normals and curvatures)at each 3D point.
void setInputCloud(const PointCloudConstPtr &cloud) override
Provide a pointer to the input dataset.
Point Cloud Data (PCD) file format reader.
int read(const std::string &file_name, pcl::PCLPointCloud2 &cloud, Eigen::Vector4f &origin, Eigen::Quaternionf &orientation, int &pcd_version, const int offset=0) override
Read a point cloud data from a PCD file and store it into a pcl/PCLPointCloud2.
PointCloud represents the base class in PCL for storing collections of 3D points.
shared_ptr< PointCloud< PointT > > Ptr
search::KdTree is a wrapper class which inherits the pcl::KdTree class for performing search function...
shared_ptr< KdTree< PointT, Tree > > Ptr
Simple point cloud visualization class.
bool wasStopped(int millis_to_wait=1)
Check if the gui was quit, you should quit also.
void showCloud(const ColorCloud::ConstPtr &cloud, const std::string &cloudname="cloud")
Show a cloud, with an optional key for multiple clouds.
Define standard C methods and C++ classes that are common to all methods.
Defines all the PCL implemented PointT point type structures.
void getMinMax3D(const pcl::PointCloud< PointT > &cloud, PointT &min_pt, PointT &max_pt)
Get the minimum and maximum values on each of the 3 (x-y-z) dimensions in a given pointcloud.
shared_ptr< Indices > IndicesPtr
A point structure representing normal coordinates and the surface curvature estimate.
A point structure representing Euclidean xyz coordinates.
PointXYZ operator()(const Normal &n) const
PointCloud< Normal >::Ptr normals_surface
PointCloud< Normal >::Ptr normals
static const int max_elements
PointCloud< PointXYZ >::Ptr surface
DataSource(const std::string &file="d:/office_chair_model.pcd")
std::vector< std::vector< int > > neighbors_all
void getNeghborsArray(std::vector< int > &data)
void generateIndices(std::size_t step=100)
void findRadiusNeghbors(float radius=-1)
void runCloudViewer() const
PointCloud< PointXYZ >::Ptr cloud
__PCL_GPU_HOST_DEVICE__ T * ptr(int y=0)