ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Nihad's profile - activity

2022-11-21 04:20:27 -0500 received badge  Famous Question (source)
2021-02-25 00:33:39 -0500 received badge  Famous Question (source)
2019-10-15 02:11:15 -0500 marked best answer Getting Error in OrganizedMultiPlaneSegmentation.

I tried to use use OrganizedMultiPlaneSegmentation, but I got an error. Error msg is like "error C2664: 'void pcl::OrganizedMultiPlaneSegmentation<pointt,pointnt,pointlt>::segmentAndRefine(std::vector<_Ty,_Ax> &)' : cannot convert parameter 1 from 'std::vector<_Ty>' to 'std::vector<_Ty,_Ax> &'" Here is my sample code. Your advice is most appreciable. Thanx in advance.

int main(..) 
{ 
//Load point cloud. 

pcl::PointCloud<pcl::Normal>::Ptr normals (new pcl::PointCloud<pcl::Normal>); 
pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> ne; 
ne.setInputCloud (cloud.makeShared()); 
pcl::search::KdTree<pcl::PointXYZ>::Ptr tree (new pcl::search::KdTree<pcl::PointXYZ> ()); 
ne.setSearchMethod (tree); 
int k=3; 
ne.setKSearch(k); 
ne.compute (*normals); 

pcl::OrganizedMultiPlaneSegmentation<pcl::PointXYZ,pcl::Normal,pcl::Label>mps; //Error 
mps.setMinInliers(1000); 
mps.setAngularThreshold(0.017453*2.0); 
mps.setDistanceThreshold(0.02); 
mps.setInputNormals(normals); 
mps.setInputCloud(cloud.makeShared()); 
std::vector<pcl::PlanarRegion<pcl::PointXYZ>>regions;//Error 
mps.segmentAndRefine(regions); //Error 
}
2016-09-06 05:55:56 -0500 received badge  Famous Question (source)
2016-03-17 13:55:44 -0500 marked best answer How can I print VFH signature?

I want to print VFH signature. Below is my sample code. After VFH signature calculation, how can i print this?

int main (int argc, char** argv)
{
  pcl::PointCloud<pcl::PointXYZ> cloud;

  //pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);

  // Fill in the cloud data
  cloud.width    = 50;
  cloud.height   = 1;
  cloud.is_dense = false;
  cloud.points.resize (cloud.width * cloud.height);


  for (size_t i = 0; i < cloud.points.size (); ++i)
  {
    cloud.points[i].x = 1024 * rand () / (RAND_MAX + 1.0f);
    cloud.points[i].y = 1024 * rand () / (RAND_MAX + 1.0f);
    cloud.points[i].z = 1024 * rand () / (RAND_MAX + 1.0f);

  }

pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> ne;
          ne.setInputCloud (cloud.makeShared());

          // Create an empty kdtree representation, and pass it to the normal estimation object.
          // Its content will be filled inside the object, based on the given input dataset (as no other search surface is given).

          pcl::search::KdTree<pcl::PointXYZ>::Ptr cloud_normal_tree (new pcl::search::KdTree<pcl::PointXYZ>());
          ne.setSearchMethod (cloud_normal_tree);

          // Output datasets
          pcl::PointCloud<pcl::Normal>::Ptr normals (new pcl::PointCloud<pcl::Normal>);

          // Use all neighbors in a sphere of radius 3cm
          ne.setRadiusSearch (0.03);

          // Compute the features
          ne.compute (*normals);

          // Create the VFH estimation class, and pass the input dataset+normals to it
          pcl::VFHEstimation<pcl::PointXYZ, pcl::Normal, pcl::VFHSignature308> vfh;
          vfh.setInputCloud (cloud.makeShared ());
          vfh.setInputNormals (normals);
          // alternatively, if cloud is of type PointNormal, do vfh.setInputNormals (cloud);

          // Create an empty kdtree representation, and pass it to the FPFH estimation object.
          // Its content will be filled inside the object, based on the given input dataset (as no other search surface is given).
          pcl::search::KdTree<pcl::PointXYZ>::Ptr tree (new pcl::search::KdTree<pcl::PointXYZ> ());
          vfh.setSearchMethod (tree);

          // Output datasets
          pcl::PointCloud<pcl::VFHSignature308>::Ptr vfhs (new pcl::PointCloud<pcl::VFHSignature308> ());

          // Compute the features
          vfh.compute (*vfhs);
}
2016-03-17 13:55:08 -0500 marked best answer Moving Least Squares (MLS) surface reconstruction method.

I am trying to use following code which states how a Moving Least Squares (MLS) surface reconstruction method can be used to smooth and resample noisy data, but it gives error like "pcl::IOException ("[pcl::PCDWriter::writeASCII] Input point cloud has no data!");". I use same code from the link http://pointclouds.org/documentation/tutorials/resampling.php .

#include <pcl/point_types.h>
#include <pcl/io/pcd_io.h>
#include <pcl/kdtree/kdtree_flann.h>
#include <pcl/surface/mls.h>

int
main (int argc, char** argv)
{
  pcl::PointCloud<pcl::PointXYZ> cloud;

  // Fill in the cloud data
  cloud.width    = 5;
  cloud.height   = 1;
  cloud.is_dense = false;
  cloud.points.resize (cloud.width * cloud.height);

  for (size_t i = 0; i < cloud.points.size (); ++i)
  {
    cloud.points[i].x = 1024 * rand () / (RAND_MAX + 1.0f);
    cloud.points[i].y = 1024 * rand () / (RAND_MAX + 1.0f);
    cloud.points[i].z = 1024 * rand () / (RAND_MAX + 1.0f);
  }

  pcl::io::savePCDFileASCII ("test_pcd.pcd", cloud);
  std::cerr << "Saved " << cloud.points.size () << " data points to test_pcd.pcd." << std::endl;

  for (size_t i = 0; i < cloud.points.size (); ++i)
    std::cerr << "    " << cloud.points[i].x << " " << cloud.points[i].y << " " << cloud.points[i].z << std::endl;

  // Create a KD-Tree
  pcl::search::KdTree<pcl::PointXYZ>::Ptr tree (new pcl::search::KdTree<pcl::PointXYZ>);

  // Output has the PointNormal type in order to store the normals calculated by MLS
  pcl::PointCloud<pcl::PointNormal> mls_points;

  // Init object (second point type is for the normals, even if unused)
  pcl::MovingLeastSquares<pcl::PointXYZ, pcl::PointNormal> mls;

  mls.setComputeNormals (true);

  // Set parameters
  mls.setInputCloud (cloud.makeShared());
  mls.setPolynomialFit (true);
  mls.setSearchMethod (tree);
  mls.setSearchRadius (0.03);

  // Reconstruct
  mls.process (mls_points);

  // Save output
  pcl::io::savePCDFile ("bun0-mls.pcd", mls_points);
}
2015-11-02 07:51:06 -0500 received badge  Famous Question (source)
2014-09-08 17:10:15 -0500 received badge  Famous Question (source)
2014-09-08 17:10:15 -0500 received badge  Notable Question (source)
2014-06-19 04:13:13 -0500 received badge  Notable Question (source)
2014-06-13 08:23:27 -0500 received badge  Notable Question (source)
2014-06-13 08:23:27 -0500 received badge  Famous Question (source)
2014-06-13 08:23:27 -0500 received badge  Popular Question (source)
2014-04-15 03:11:43 -0500 received badge  Famous Question (source)
2014-01-28 17:30:21 -0500 marked best answer Question about Surface Normal Calculation

I am new in PCL framework. I want to know how PCL calculate surface normal. I used only three points to calculate surface normal, but failed to estimate surface normal. I collected the code from the link http://www.pointclouds.org/documentation/tutorials/normal_estimation.php#normal-estimation. I modied little. According to my understanding about surface normal, it should provide some value. Unfornately, it provided garbage value (-1.#ND). Here is my sample code and input file. Thanx in advance.

Input: 1 1 1 
         2 2 2 
         3 3 3 

Output: -1.#ND -1.#ND -1.#ND 
           -1.#ND -1.#ND -1.#ND 
           -1.#ND -1.#ND -1.#ND

Code:

int main(..) 
{ 
pcl::PointCloud<pcl::PointXYZ> cloud; 

  cloud.width    = 3; 
  cloud.height   = 1; 
  cloud.is_dense = false; 
  cloud.points.resize (cloud.width * cloud.height); 

  int x_i=1,y_i=1,z_i=1; 
  for (size_t i = 0; i < cloud.points.size (); ++i) 
  { 

    cloud.points[i].x = x_i; 
    cloud.points[i].y = y_i; 
    cloud.points[i].z = z_i; 
        x_i++; 
        y_i++; 
        z_i++; 

  } 

pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> ne; 
ne.setInputCloud (cloud.makeShared()); 
pcl::search::KdTree<pcl::PointXYZ>::Ptr tree (new pcl::search::KdTree<pcl::PointXYZ> ()); 
ne.setSearchMethod (tree); 
pcl::PointCloud<pcl::Normal>::Ptr cloud_normals (new pcl::PointCloud<pcl::Normal>); 
int k=3; 
ne.setKSearch (k); 
ne.compute (*cloud_normals); 
std::cerr << "Normal cloud size " << cloud_normals->points.size()<< std::endl; 

for (size_t i = 0; i < cloud_normals->points.size(); ++i) 
        std::cerr << "    " << cloud_normals->points[i].normal_x << " " << cloud_normals->points[i].normal_y << " " << cloud_normals->points[i].normal_z << std::endl; 

}
2014-01-28 17:30:19 -0500 marked best answer Boundary Estimation Error.

I am trying to extract boundary points from point cloud,and want to print the boundary points.Unfortunately, I got error like error C2248: 'pcl::BoundaryEstimation<pointint,pointnt,pointoutt>::computeFeature' : cannot access protected member declared in class 'pcl::BoundaryEstimation<pointint,pointnt,pointoutt>'. Did anybody experience this? Thanx in advance.

Here is my sample code.

int main (..) 
{ 
//Load point cloud 

pcl::PointCloud<pcl::Normal>::Ptr normals (new pcl::PointCloud<pcl::Normal>); 
pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> ne; 
ne.setInputCloud (cloud.makeShared()); 
pcl::search::KdTree<pcl::PointXYZ>::Ptr tree (new pcl::search::KdTree<pcl::PointXYZ> ()); 
ne.setSearchMethod (tree); 
ne.setRadiusSearch (0.03); 
ne.compute (*normals); 

pcl::PointCloud<pcl::Boundary> boundaries; 
pcl::BoundaryEstimation<pcl::PointXYZ, pcl::Normal, pcl::Boundary> est; 
est.setInputCloud (cloud.makeShared()); 
est.setInputNormals (normals); 
est.setRadiusSearch (0.03); 
est.setSearchMethod (pcl::search::KdTree<pcl::PointXYZ>::Ptr (new pcl::search::KdTree<pcl::PointXYZ>)); 
est.compute (boundaries); 

pcl::PointCloud<pcl::Boundary>::Ptr boundary_cloud (new pcl::PointCloud<pcl::Boundary> ()); 
est.computeFeature(*boundary_cloud); /// Error Here 

cout<<"Boundary Size:"<<boundaries.points.size()<<endl; 
}
2014-01-28 17:30:19 -0500 marked best answer Point Cloud Visualization Error.

I am trying to visualize point cloud, but it gave error like error C2664: 'void pcl::visualization::CloudViewer::showCloud(const boost::shared_ptr<t> &,const std::string &)' : cannot convert parameter 1 from 'pcl::PointCloud<pointt>' to 'const boost::shared_ptr<t> &'. Thanks in advance.

Here is my sample code:

#include <iostream>

#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/visualization/cloud_viewer.h>

int main (int argc, char** argv) 
{ 
  pcl::PointCloud<pcl::PointXYZ> cloud; 

  // Fill in the cloud data 
  cloud.width    = 5; 
  cloud.height   = 1; 
  cloud.is_dense = false; 
  cloud.points.resize (cloud.width * cloud.height); 

  for (size_t i = 0; i < cloud.points.size (); ++i) 
  { 
    cloud.points[i].x = 1024 * rand () / (RAND_MAX + 1.0f); 
    cloud.points[i].y = 1024 * rand () / (RAND_MAX + 1.0f); 
    cloud.points[i].z = 1024 * rand () / (RAND_MAX + 1.0f); 
  } 

  pcl::visualization::CloudViewer viewer ("Simple Cloud Viewer"); 
  viewer.showCloud (cloud); 

  while (!viewer.wasStopped ()) 
  { 
  } 

  return (0); 
}
2014-01-28 17:30:16 -0500 marked best answer PointNormal to PointXYZ transfer problem.

I want to transfer some PointNormal values to PointXYZ. I tried by following way, but it gave error. How can I do this?

int main(...) 
{ 
......... 
........ 
pcl::PointCloud<pcl::PointNormal> mls_points; 

// Init object (second point type is for the normals, even if unused) 
pcl::MovingLeastSquares<pcl::PointXYZ, pcl::PointNormal> mls; 
...................................... 
..................................... 
mls.process (mls_points); 
pcl::PointCloud<pcl::PointXYZ>::Ptr mls_cloud (new pcl::PointCloud<pcl::PointXYZ>); 


                  for (size_t i = 0; i < mls_points.points.size(); ++i) 
                  { 
                          mls_cloud->points[i].x=mls_points.points[i].x; //error 
                          mls_cloud->points[i].y=mls_points.points[i].y; //error 
                          mls_cloud->points[i].z=mls_points.points[i].z; //error 
                  } 
................................ 

}
2014-01-28 17:29:58 -0500 marked best answer Point Feature Histograms Calculation.

To compute a single PFH representation from a k-neighborhood, we use:

computePointPFHSignature (const pcl::PointCloud<PointInT> &cloud,
                          const pcl::PointCloud<PointNT> &normals,
                          const std::vector<int> &indices,
                          int nr_split,
                          Eigen::VectorXf &pfh_histogram);

How can I calculate vector indices which represents the set of k-nearest neighbors from cloud?

2014-01-28 17:29:57 -0500 marked best answer Cloud Normal Calculation.

I want to see the cloud normal for a given point cloud in vector format means in position vector. Here is my sample code. From my code, I can found only the cloud normal points size.

#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>

#include <pcl/surface/convex_hull.h>
#include <pcl/surface/mls.h>

#include <pcl/filters/filter.h>
#include <pcl/filters/voxel_grid.h>

#include <pcl/features/normal_3d.h>
#include <pcl/features/boundary.h>

#include <pcl/registration/distances.h>


#include <pcl/kdtree/kdtree_flann.h>


#include <Eigen/Dense>
#include <Eigen/Sparse>
#include <Eigen/Geometry>

using namespace Eigen;

int main (int argc, char** argv)
{
  pcl::PointCloud<pcl::PointXYZ> cloud;

  // Fill in the cloud data
  cloud.width    = 5;
  cloud.height   = 1;
  cloud.is_dense = false;
  cloud.points.resize (cloud.width * cloud.height);

  for (size_t i = 0; i < cloud.points.size (); ++i)
  {
    cloud.points[i].x = 1024 * rand () / (RAND_MAX + 1.0f);
    cloud.points[i].y = 1024 * rand () / (RAND_MAX + 1.0f);
    cloud.points[i].z = 1024 * rand () / (RAND_MAX + 1.0f);
  }

  pcl::io::savePCDFileASCII ("test_pcd.pcd", cloud);
  std::cerr << "Saved " << cloud.points.size () << " data points to test_pcd.pcd." << std::endl;

  for (size_t i = 0; i < cloud.points.size (); ++i)
    std::cerr << "    " << cloud.points[i].x << " " << cloud.points[i].y << " " << cloud.points[i].z << std::endl;

// Create the normal estimation class, and pass the input dataset to it

          pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> ne;
          ne.setInputCloud (cloud.makeShared());

          // Create an empty kdtree representation, and pass it to the normal estimation object.
          // Its content will be filled inside the object, based on the given input dataset (as no other search surface is given).
          pcl::search::KdTree<pcl::PointXYZ>::Ptr tree (new pcl::search::KdTree<pcl::PointXYZ> ());
          ne.setSearchMethod (tree);

          // Output datasets
          pcl::PointCloud<pcl::Normal>::Ptr cloud_normals (new pcl::PointCloud<pcl::Normal>);

          // Use all neighbors in a sphere of radius 3cm
          ne.setRadiusSearch (0.03);

          // Compute the features
          ne.compute (*cloud_normals);

          std::cerr << "Normal cloud size " << cloud_normals->points.size()<< std::endl;

}
2014-01-28 17:29:56 -0500 marked best answer How can I run simple PCL program?

I want to run a simple PCL program, but it gave error like "Unable to start program c:\GrabPCD\build_pcl\x64\Debug\All_build The system can`t find the file specified."

I am using Windows7 MSVC2010.

#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>

int
  main (int argc, char** argv)
{
  pcl::PointCloud<pcl::PointXYZ> cloud;

  // Fill in the cloud data
  cloud.width    = 5;
  cloud.height   = 1;
  cloud.is_dense = false;
  cloud.points.resize (cloud.width * cloud.height);

  for (size_t i = 0; i < cloud.points.size (); ++i)
  {
    cloud.points[i].x = 1024 * rand () / (RAND_MAX + 1.0f);
    cloud.points[i].y = 1024 * rand () / (RAND_MAX + 1.0f);
    cloud.points[i].z = 1024 * rand () / (RAND_MAX + 1.0f);
  }

  pcl::io::savePCDFileASCII ("test_pcd.pcd", cloud);
  std::cerr << "Saved " << cloud.points.size () << " data points to test_pcd.pcd." << std::endl;

  for (size_t i = 0; i < cloud.points.size (); ++i)
    std::cerr << "    " << cloud.points[i].x << " " << cloud.points[i].y << " " << cloud.points[i].z << std::endl;

  return (0);
}
2014-01-28 17:29:54 -0500 marked best answer How can I construct convex hull from point cloud?

I want to construct convex hull from point cloud, but it gave error. I am new in PCL. Below my sample code is given. The line where error message is given indicated by error message.

int main(.......) 
{ 
.................. 
pcl::PointCloud<pcl::PointXYZ> cloud; 

        // Fill in the cloud data 
        cloud.width    = 5; 
        cloud.height   = 1; 
        cloud.is_dense = false; 
        cloud.points.resize (cloud.width * cloud.height); 


        for (size_t i = 0; i < cloud.points.size (); ++i) 
        { 
                cloud.points[i].x = 1024 * rand () / (RAND_MAX + 1.0f); 
                cloud.points[i].y = 1024 * rand () / (RAND_MAX + 1.0f); 
                cloud.points[i].z = 1024 * rand () / (RAND_MAX + 1.0f); 

        } 



        std::cerr << "Saved " << cloud.points.size () << " data points to test_pcd.pcd." << std::endl; 

        for (size_t i = 0; i < cloud.points.size (); ++i) 
                std::cerr << "    " << cloud.points[i].x << " " << cloud.points[i].y << " " << cloud.points[i].z << std::endl; 

        pcl::ConvexHull< pcl::PointXYZ >::reconstruct(cloud);  // error message 

.................. 
}
2014-01-21 04:23:24 -0500 received badge  Popular Question (source)
2014-01-21 04:23:24 -0500 received badge  Notable Question (source)
2014-01-21 04:23:24 -0500 received badge  Famous Question (source)
2013-10-08 02:28:36 -0500 received badge  Notable Question (source)