Reading .ply wih normal data.

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

Reading .ply wih normal data.

Bahtiyar Kaba
I use kinect to capture a set of point clouds, and when scanning I also estimate the point normals, and save the results as ply files. I want to keep the normal data with cloud data and later read them properly.

But when I try to read them back again it says something like this:
Failed to find match for field 'normal_x'.
Failed to find match for field 'normal_y'.
Failed to find match for field 'normal_z'.

I am trying to use appropriate data types, however, the problem persists. I put below the header of ply file in ascii, and the code that I am trying to read this ply file.

Do you have any idea of what the problem can be?
Thanks in advance,

ply
format ascii 1.0
comment PCL generated
element vertex 42717
property float x
property float y
property float z
property uchar red
property uchar green
property uchar blue
property float nx
property float ny
property float nz
property float curvature
element camera 1
property float view_px
property float view_py
property float view_pz
property float x_axisx
property float x_axisy
property float x_axisz
property float y_axisx
property float y_axisy
property float y_axisz
property float z_axisx
property float z_axisy
property float z_axisz
property float focal
property float scalex
property float scaley
property float centerx
property float centery
property int viewportx
property int viewporty
property float k1
property float k2
end_header

To read the file,

    pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr source_temp(new pcl::PointCloud<pcl::PointXYZRGBNormal>);
    pcl::io::loadPLYFile(argv[4], *source_temp);

Reply | Threaded
Open this post in threaded view
|

Re: Reading .ply wih normal data.

aichim
Administrator
Hi,

Yes, the fields in the ply files are not really standardized, so you will see normals being saved as either nx,ny,nz or normal_x,normal_y,normal_z depending on the software you are using. I remember having solved this issue some time ago, and made our readers support both.

Which version of PCL are you using?

Cheers,
Alex
---
http://www.openperception.org



On Feb 4, 2013, at 2:16 AM, Bahtiyar Kaba <[hidden email]> wrote:

> I use kinect to capture a set of point clouds, and when scanning I also
> estimate the point normals, and save the results as ply files. I want to
> keep the normal data with cloud data and later read them properly.
>
> But when I try to read them back again it says something like this:
> Failed to find match for field 'normal_x'.
> Failed to find match for field 'normal_y'.
> Failed to find match for field 'normal_z'.
>
> I am trying to use appropriate data types, however, the problem persists. I
> put below the header of ply file in ascii, and the code that I am trying to
> read this ply file.
>
> Do you have any idea of what the problem can be?
> Thanks in advance,
>
> ply
> format ascii 1.0
> comment PCL generated
> element vertex 42717
> property float x
> property float y
> property float z
> property uchar red
> property uchar green
> property uchar blue
> property float nx
> property float ny
> property float nz
> property float curvature
> element camera 1
> property float view_px
> property float view_py
> property float view_pz
> property float x_axisx
> property float x_axisy
> property float x_axisz
> property float y_axisx
> property float y_axisy
> property float y_axisz
> property float z_axisx
> property float z_axisy
> property float z_axisz
> property float focal
> property float scalex
> property float scaley
> property float centerx
> property float centery
> property int viewportx
> property int viewporty
> property float k1
> property float k2
> end_header
>
> To read the file,
>
>    pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr source_temp(new
> pcl::PointCloud<pcl::PointXYZRGBNormal>);
>    pcl::io::loadPLYFile(argv[4], *source_temp);
>
>
>
>
>
> --
> View this message in context: http://www.pcl-users.org/Reading-ply-wih-normal-data-tp4025845.html
> Sent from the Point Cloud Library (PCL) Users mailing list 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: Reading .ply wih normal data.

Bahtiyar Kaba
I am using PCL 1.6 . For now I am storing the point cloud (with normals) in .pcd files and reading them back. This way there is no problem. But there are times that I want to edit the cloud manually, and the third party software does not work with them.
I have searched the mailing archive, there were some other problems related to .ply files with normals but I could'nt find fix for my case.
Thank you for your reply.
Reply | Threaded
Open this post in threaded view
|

Re: Reading .ply wih normal data.

aichim
Administrator
Hi,

Can you give PCL trunk a shot?

Cheers,
Alex
---
http://www.openperception.org



On Feb 6, 2013, at 1:27 AM, Bahtiyar Kaba <[hidden email]> wrote:

> I am using PCL 1.6 . For now I am storing the point cloud (with normals) in
> .pcd files and reading them back. This way there is no problem. But there
> are times that I want to edit the cloud manually, and the third party
> software does not work with them.
> I have searched the mailing archive, there were some other problems related
> to .ply files with normals but I could'nt find fix for my case.
> Thank you for your reply.
>
>
>
> --
> View this message in context: http://www.pcl-users.org/Reading-ply-wih-normal-data-tp4025845p4025914.html
> Sent from the Point Cloud Library (PCL) Users mailing list 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: Reading .ply wih normal data.

andyk
Just to chip in here....

I had the same issue with normals when exporting .ply files to MeshLab when I was using PCL 1.5.1

I moved to trunk in December and the normals work perfectly in that revision, but I can't vouch for PCL 1.6 as I never used it.
Reply | Threaded
Open this post in threaded view
|

Re: Reading .ply wih normal data.

andersgb1
I can confirm that the problem is also present in 1.6, so must have been solved after that.
Reply | Threaded
Open this post in threaded view
|

Re: Reading .ply wih normal data.

allaryane
This post has NOT been accepted by the mailing list yet.
In reply to this post by Bahtiyar Kaba
Hi,

Edit your .ply file replacing nx, ny, nz by normal_x, normal_y, normal_z ... And it gonna be OK ! It work for me.  with the follow code :

        PointCloud<PointNormal>::Ptr cloud (new PointCloud<PointNormal>);
        if(io::loadPLYFile<PointNormal> (filenameFemurNormals.c_str(), *cloud) == -1)
        {
                cout << "ERROR : couldn't find file" << endl;
                exit(0);
        }
  cout << "Point cloud have " << cloud->points.size() << " data points" << endl;