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

Is it possible to write a kd-tree to file? #252

Closed
rquey opened this issue Dec 19, 2024 · 2 comments
Closed

Is it possible to write a kd-tree to file? #252

rquey opened this issue Dec 19, 2024 · 2 comments

Comments

@rquey
Copy link

rquey commented Dec 19, 2024

In my program, I have a defined point cloud on which I perform nearest neighbor searches. The point cloud is always the same, but the program has to generate the kd-tree each time it runs (which can be a significant fraction of the total computation time).

To reduce the overhead, it would be interesting to have the kd-tree written to a file, so that the program can simply read it from the file as it runs (just as it reads the point cloud itself), instead of computing it over and over again.

I think this would be an interesting (practical) feature.

Is it possible?

@jlblancoc
Copy link
Owner

Hi @rquey ! Sure it is.
Please, check the example code for load / save the kd-tree index to file and let me know if you find any issues...

Note that the the raw data still needs to be loaded in memory and the kd-tree structure initialized as usual. The difference is that you should call loadIndex() instead of rebuilding the index.

@rquey
Copy link
Author

rquey commented Jan 27, 2025

Thank you @jlblancoc. I haven't been able to try yet, but will do it shortly and let you know if I have problems.

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