getPointsInBox always gives 0 as output

classic Classic list List threaded Threaded
1 message Options
RV
Reply | Threaded
Open this post in threaded view
|

getPointsInBox always gives 0 as output

RV
Hello,

I'm trying to extract points from a cuboid within a point cloud and to do this I'm using the getPointsInBox function but it always returns 0 as output. Here is the code snippet of what I'm trying to do:

        // Getting the min and the max point of the point cloud
        pcl::getMinMax3D (*cloud, min_pt, max_pt );
        std::cout << "Min point in point cloud is : " << min_pt << std::endl
                                << "Max point in point cloud is : " << max_pt << std::endl;

        max_pt.x = min_pt.x + lf_size;
        max_pt.y = min_pt.y + lf_size;
        max_pt.z = min_pt.z + lf_size;

        min_p[0] = min_pt.x;
        max_p[0] = max_pt.x;
        min_p[1] = min_pt.y;
        max_p[1] = max_pt.y;
        min_p[2] = min_pt.z;
        max_p[2] = max_pt.z;
        min_p[3] = 1.0f;
        max_p[3] = 1.0f;

        for ( x ; x < Xfar ; x = x + lf_size)
        {
                for ( y ; y < Yfar ; y = y + lf_size)
                {
                        for ( z ; z < Zfar ; z = z + lf_size)
                        {
                                pcl::getPointsInBox(*cloud , min_p, max_p, indices);
                                std::cout << " Points in the cuboid : " << indices.size() << std::endl ;
                        }
                 }
}

Any advise on how to solve this?
Thanks!