How to define a new point type?

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

How to define a new point type?

meijianchi
Hi everyone, If i want to define a point cloud output type, such as pointcloud<Eigen::Matrx4f>, how should i process in detail? Thanks very much.
Reply | Threaded
Open this post in threaded view
|

Re: How to define a new point type?

aichim
Administrator


On Tue, May 28, 2013 at 9:57 AM, meijianchi <[hidden email]> wrote:
Hi everyone, If i want to define a point cloud output type, such as
pointcloud<Eigen::Matrx4f>, how should i process in detail? Thanks very
much.




--
View this message in context: http://www.pcl-users.org/How-to-define-a-new-point-type-tp4028012.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: How to define a new point type?

meijianchi
Yes, I dis as the tutorial tells, but some errors occurs.
My codes are as follows:

#include <pcl/point_types.h>
#include <pcl/point_cloud.h>
#include <pcl/io/pcd_io.h>
#include <Eigen/Dense>
struct MyPointType
{
        PCL_ADD_POINT4D;
        Eigen::Matrix2f ccdescriptor;
        EIGEN_MAKE_ALIGNED_OPERATOR_NEW  
} EIGEN_ALIGN16;                  
POINT_CLOUD_REGISTER_POINT_STRUCT(MyPointType,
                                      (float, x, x)
                                      (float, y, y)
                                      (float, z, z)
                                     (Eigen::Matrix2f, ccdescriptor, ccdescriptor))
int
main (int argc, char** argv)
{
        pcl::PointCloud<MyPointType> cloud;
        cloud.points.resize (2);
        cloud.width = 2;
        cloud.height = 1;
        //float a[2][2]={1,1,2,2};
        //float b[2][2]={2,3,1,3};
        cloud.points[0].x = cloud.points[0].y = cloud.points[0].z = 0;
        cloud.points[1].x = cloud.points[1].y = cloud.points[1].z = 3;
        cloud.points[0].ccdescriptor<<1,1,2,2;
        cloud.points[1].ccdescriptor<<2,3,1,2;
        pcl::io::savePCDFile ("test.pcd", cloud);
        std::cout<<cloud.points[1].ccdescriptor<<std::endl;
}

The errors are as follows:

2>..\main.cpp(17): error C2039: 'value' : is not a member of 'pcl::traits::asEnum<T>'
2>          with
2>          [
2>              T=Eigen::Matrix<float,2,2>
2>          ]
2>..\main.cpp(17): error C2065: 'value' : undeclared identifier
2>..\main.cpp(17): error C2057: expected constant expression

Thanks very much. I am expecting your reply.
Reply | Threaded
Open this post in threaded view
|

Re: How to define a new point type?

meijianchi
Is anyone who knows?
Reply | Threaded
Open this post in threaded view
|

Re: How to define a new point type?

Radu B. Rusu
Administrator
In reply to this post by meijianchi
Point types should only contain POD types.

Cheers,
Radu.
--
http://openperception.org

On 05/28/2013 01:35 AM, meijianchi wrote:

> Yes, I dis as the tutorial tells, but some errors occurs.
> My codes are as follows:
>
> #include <pcl/point_types.h>
> #include <pcl/point_cloud.h>
> #include <pcl/io/pcd_io.h>
> #include <Eigen/Dense>
> struct MyPointType
> {
> PCL_ADD_POINT4D;
> Eigen::Matrix2f ccdescriptor;
> EIGEN_MAKE_ALIGNED_OPERATOR_NEW
> } EIGEN_ALIGN16;
> POINT_CLOUD_REGISTER_POINT_STRUCT(MyPointType,
>                              (float, x, x)
>      (float, y, y)
>      (float, z, z)
>                             (Eigen::Matrix2f, ccdescriptor, ccdescriptor))
> int
> main (int argc, char** argv)
> {
> pcl::PointCloud<MyPointType> cloud;
> cloud.points.resize (2);
> cloud.width = 2;
> cloud.height = 1;
> //float a[2][2]={1,1,2,2};
> //float b[2][2]={2,3,1,3};
> cloud.points[0].x = cloud.points[0].y = cloud.points[0].z = 0;
> cloud.points[1].x = cloud.points[1].y = cloud.points[1].z = 3;
> cloud.points[0].ccdescriptor<<1,1,2,2;
> cloud.points[1].ccdescriptor<<2,3,1,2;
> pcl::io::savePCDFile ("test.pcd", cloud);
> std::cout<<cloud.points[1].ccdescriptor&lt;&lt;std::endl;
> }
>
> The errors are as follows:
>
> 2>..\main.cpp(17): error C2039: 'value' : is not a member of
> 'pcl::traits::asEnum<T>'
> 2>          with
> 2>          [
> 2>              T=Eigen::Matrix<float,2,2>
> 2>          ]
> 2>..\main.cpp(17): error C2065: 'value' : undeclared identifier
> 2>..\main.cpp(17): error C2057: expected constant expression
>
> Thanks very much. I am expecting your reply.
>
>
>
> --
> View this message in context: http://www.pcl-users.org/How-to-define-a-new-point-type-tp4028012p4028014.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