Normal Estimation Using Integral Images Error. [closed]

asked 2013-04-01 16:49:30 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I am trying estimate normal using Integral Images, but it gave like error "[pcl::IntegralImageNormalEstimation::initCompute] Input dataset is not organized (height = 1). Normal cloud size 0". Here is my code sample. It seems everything is perfect, but unexpected result Normal cloud size=0.

#include <iostream>
#include <pcl/io/io.h>  
#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/filters/passthrough.h>
#include <pcl/filters/statistical_outlier_removal.h>



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


#include <pcl/registration/distances.h>


#include <pcl/kdtree/kdtree_flann.h>

#include <pcl/visualization/cloud_viewer.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);

  }
//// estimate normals
         pcl::PointCloud<pcl::Normal>::Ptr normals (new pcl::PointCloud<pcl::Normal>);

             pcl::IntegralImageNormalEstimation<pcl::PointXYZ, pcl::Normal> ne;
             ne.setNormalEstimationMethod(ne.AVERAGE_3D_GRADIENT);
             ne.setMaxDepthChangeFactor(0.02f);
             ne.setNormalSmoothingSize(10.0f);
         ne.setInputCloud(cloud.makeShared());
             ne.compute(*normals);

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

             for (size_t i = 0; i < normals->points.size(); ++i)
               std::cerr << "    " << normals->points[i].normal_x << " " << normals->points[i].normal_y << " " << normals->points[i].normal_z << std::endl;
}
edit retag flag offensive reopen merge delete

Closed for the following reason PCL Question: The PCL community prefers to answer questions at http://www.pcl-users.org/ by tfoote
close date 2014-11-23 03:16:03.487940

Comments

Hi, i got the same error with kinect streaming point-cloud. Normal cloud size always zero....!!! The code seems right and i don't know how to solve that error. Could you give me some hints if you solved the problem?? Thanks.

GioRos gravatar image GioRos  ( 2014-03-11 07:51:25 -0500 )edit