Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Octree Box search crash. #97

Closed
nihad861 opened this issue May 24, 2013 · 1 comment
Closed

Octree Box search crash. #97

nihad861 opened this issue May 24, 2013 · 1 comment
Assignees

Comments

@nihad861
Copy link

I am dealing with octree box search. It seems it could not produce valid result. For test purpose, I deal with only eight points, and I set lower & upper corner values. It is expected it will produce all values from input cloud. Here is my code.

int main(..)
{
pcl::PointCloudpcl::PointXYZ cloud;
cloud.width = 8;
cloud.height = 1;
cloud.is_dense = false;
cloud.points.resize (cloud.width * cloud.height);

float box_point[8][3] = {
{0, 0, 0},
{0, 2, 0},
{0, 1, 1},
{0, 3, 1},
{0, 0, 3},
{0, 2, 3},
{0, 1, 4},
{0, 3, 4}
};

for (size_t i = 0; i < cloud.points.size (); ++i)

{

cloud.points[i].x = box_point[i][0]; 
cloud.points[i].y = box_point[i][1]; 
cloud.points[i].z = box_point[i][2]; 

}

float resolution = 0.1;
pcl::octree::OctreePointCloudSearchpcl::PointXYZ octree (resolution);
octree.setInputCloud (cloud.makeShared());
octree.addPointsFromInputCloud ();

std::vector pointIdxVec;
Eigen::Vector3f min_pt(0,0,0);
Eigen::Vector3f max_pt(0,3,4);

octree.boxSearch(min_pt,max_pt,pointIdxVec);

for (size_t i = 0; i < pointIdxVec.size (); ++i)
std::cout << " " << cloud.points[pointIdxVec[i]].x
<< " " << cloud.points[pointIdxVec[i]].y
<< " " << cloud.points[pointIdxVec[i]].z << std::endl;
cout<<"PointIdxVec size:"<<pointIdxVec.size ()<<endl;
}

My understanding is output would be 8 points, but i got 0 point. ur suggession most appreciable. Thanks in advance.

@ghost ghost assigned jkammerl May 27, 2013
@jkammerl
Copy link
Member

jkammerl commented Jun 1, 2013

Thanks for your bug report!

Here you'll find the fix:
#10

Please let me know if it works for you.

Cheers, Julius

@jkammerl jkammerl closed this as completed Jun 1, 2013
fran6co pushed a commit to fran6co/pcl that referenced this issue Nov 12, 2013
fran6co pushed a commit to fran6co/pcl that referenced this issue Nov 12, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants