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

The result of nanoflann returned #196

Open
whu-lyh opened this issue Mar 8, 2023 · 3 comments
Open

The result of nanoflann returned #196

whu-lyh opened this issue Mar 8, 2023 · 3 comments

Comments

@whu-lyh
Copy link

whu-lyh commented Mar 8, 2023

nanoflann::KdTreeFLANN<PB::pmPointXYZ>::Ptr kdtree = std::make_shared<nanoflann::KdTreeFLANN<PB::pmPointXYZ>>();
if (!kdtree) {
    std::cerr << "KD tree build failed!" << std::endl;
    return;
}
kdtree->setInputCloud(cloud);
for (int i = 0; i < checkcorrs.size(); ++i) {
    std::vector<int> searchIndexes;
    std::vector<SCALAR_TYPE> distances;
    SCALAR_TYPE *search_pt = new SCALAR_TYPE[3];
    search_pt[0] = checkcorrs[i].x;
    search_pt[1] = checkcorrs[i].y;
    search_pt[2] = checkcorrs[i].z;
    kdtree->radiusSearch(search_pt, 2.0, searchIndexes, distances);
}

The size of searchIndexes is always equal to 1 during the for-loop(I have checked the point that the number of the nearest point is large), and once the searched point's distance is too large(e.g. distance>10m ), the searchIndexes[0] also be same with the i-1 iteration result. What's the point? Is this a bug?

@whu-lyh
Copy link
Author

whu-lyh commented Mar 8, 2023

forget to mention that I write a adaptor of the original nanoflann kdtree class for better usage.

@jlblancoc
Copy link
Owner

Hi @whu-lyh :

Please, we would need a complete, minimum size, full code (a CMakeLists.txt + test.cpp) and data (if applicable) to verify what's going on.

@whu-lyh
Copy link
Author

whu-lyh commented Apr 9, 2023

@jlblancoc , thanks for the reply but I could not provide the minimum size code for now, and I implement the kdtree search operation with CoudCompare octree for the deadline of project in a hurry. I will try to reproduce this bug.

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