PCL: Input dataset is not from a projective device!

asked 2019-09-02 04:43:52 -0500

S.Yildiz gravatar image

updated 2022-10-18 07:37:37 -0500

ravijoshi gravatar image

I have a rgbd camera (pico monstar) and I want to use the statistical outlier removal filter on it. I use the following code:

ros::Publisher pub;

void cloud_cb(const sensor_msgs::PointCloud2ConstPtr& input)
{
  // Convert the sensor_msgs/PointCloud2 data to pcl/PointCloud
  pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>());
  pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_filtered(new pcl::PointCloud<pcl::PointXYZ>());
  pcl::fromROSMsg(*input, *cloud);

  pcl::StatisticalOutlierRemoval<pcl::PointXYZ> sor;
  sor.setInputCloud(cloud);
  sor.setMeanK(50);
  sor.setStddevMulThresh(1.0);
  sor.filter(*cloud_filtered);

  sensor_msgs::PointCloud2::Ptr cloud_filtered2(new sensor_msgs::PointCloud2());
  pcl::toROSMsg(*cloud_filtered, *cloud_filtered2);

  // Publish the dataSize
  pub.publish(cloud_filtered2);
}

int main(int argc, char** argv)
{
  // Initialize ROS
  ros::init(argc, argv, "statistical_outlier");
  ros::NodeHandle nh;

  // Create a ROS subscriber for the input point cloud
  ros::Subscriber sub = nh.subscribe("/royale_camera_driver/point_cloud", 1000, cloud_cb);

  // Create a ROS publisher for the output point cloud
  pub = nh.advertise<sensor_msgs::PointCloud2>("/camera/points_voxel", 1000);

  // Spin
  ros::spin();
}

And when I run the above code, I get the following error:

[pcl::OrganizedNeighbor::radiusSearch] Input dataset is not from a projective device!
    Residual (MSE) 0.000511, using 1152 valid points

But the node is running and I get always 2 Messages in approximately 2 mins

edit retag flag offensive close merge delete

Comments

Any luck? Were you able to fix it?

Pran-Seven gravatar image Pran-Seven  ( 2022-10-17 03:49:54 -0500 )edit

@Pran-Seven please don't use an answer to leave a comment. I've moved your answer to a comment for you

jayess gravatar image jayess  ( 2022-10-17 17:46:46 -0500 )edit