How to convert Custom Point Cloud file to PCD format

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to convert Custom Point Cloud file to PCD format

cihanulas
Hi,

I have a custom Point Cloud whose columns are the XYZ points and It's extension .3d.

The file structure is as here:

PC.3d
  x   y    z
1.3 2.3 11
2.3 3.3 12
 .    .      .
 .    .      .



I want to convert this data to PCD format. I thought the following code should have worked but it did not.
pcl:FileReader::read("PC.3d",cloud)

It gives the error:
error C2352: 'pcl::FileReader::read' : illegal call of non-static member function

What I need to do to fix this?

Thanks.
Cihan.

Reply | Threaded
Open this post in threaded view
|

Re: How to convert Custom Point Cloud file to PCD format

Radu B. Rusu
Administrator
To convert a custom point cloud format to PCD you have to write your own reader first that populates a
pcl::PointCloud<T> type, and then use one of the existing PCDWriter methods.

More information about the PCD format can be found here:

http://www.pointclouds.org/documentation/tutorials/pcd_file_format.php#pcd-file-format

Cheers,
Radu.
--
Point Cloud Library (PCL) - http://pointclouds.org

On 08/19/2011 03:11 PM, cihanulas wrote:

> Hi,
>
> I have a custom Point Cloud whose columns are the XYZ points and It's
> extension .3d.
>
> The file structure is as here:
>
> PC.3d
>    x   y    z
> 1.3 2.3 11
> 2.3 3.3 12
>   .    .      .
>   .    .      .
>
>
>
> I want to convert this data to PCD format. I thought the following code
> should have worked but it did not.
> pcl:FileReader::read("PC.3d",cloud)
>
> It gives the error:
> error C2352: 'pcl::FileReader::read' : illegal call of non-static member
> function
>
> What I need to do to fix this?
>
> Thanks.
> Cihan.
>
>
>
> --
> View this message in context: http://www.pcl-users.org/How-to-convert-Custom-Point-Cloud-file-to-PCD-format-tp3269398p3269398.html
> Sent from the Point Cloud Library (PCL) Users mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: How to convert Custom Point Cloud file to PCD format

cihanulas
I solved the problem as in the following code:
Maybe you can put it in a tutorial :)

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

using std::ios;
using std::ifstream;

int main (int argc, char** argv)
{
  pcl::PointCloud<pcl::PointXYZ>::Ptr cloudPtr (new pcl::PointCloud<pcl::PointXYZ>);
 
  //Read File from file.3d to cloud
  ifstream inFile( "scan.3d", ios::in );
  double px,py,pz;
  while ( inFile >>  px >>  py >> pz ) //read each row
  {
        pcl::PointXYZ basic_point;
      basic_point.x = px;
      basic_point.y = py;
      basic_point.z = pz;
      cloudPtr->points.push_back(basic_point);
  }
  cloudPtr->width = cloudPtr->points.size ();
  cloudPtr->height = 1;
 
  //Write to pcd file
  pcl::io::savePCDFileASCII ("scan.pcd", *cloudPtr);

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

  return (0);
}


Cihan.
Reply | Threaded
Open this post in threaded view
|

Re: How to convert Custom Point Cloud file to PCD format

huanghesheng
In reply to this post by cihanulas
i have met the same .3d file, and want to correctly read them in to a pcd
file
have you get succeed?



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users