flann-lib / flann

Fast Library for Approximate Nearest Neighbors
http://people.cs.ubc.ca/~mariusm/flann
Other
2.22k stars 647 forks source link

Beginners with FLANN #451

Open zeeekiayh opened 4 years ago

zeeekiayh commented 4 years ago

I am working on a project with Idaho National Laboratory; the program we are writing would be so much more efficient if we could use the FLANN library, but we are unsure of where or how to start. I have cloned the files, but I was wondering if someone could help us learn how to use the library. Specifically, we are implementing a material reconstruction algorithm in C++, where we need to iterate through some large matrices to find 'similar neighborhoods'.

I also tried this in the terminal (from the manual), but it wasn't working: $ cd flann-x.y.z-src $ mkdir build $ cd build $ cmake .. $ make

melhashash commented 4 years ago

@zeeekiayh Try to add more information about your operating system and what are the errors you are facing. For how to use the library, you can start by reading the documentation and the provided examples.

zeeekiayh commented 4 years ago

I am using Ubuntu 18.04. These few commands I was running in the terminal, were the first things from the flann manual. It says that I need to version x.y.z, but I just realized that I don't know what to put there!

melhashash commented 4 years ago

@zeeekiayh This is the folder name with library version depending on the release you have right now. Just replace it with the folder name you have, for instance, flann-1.9.1

zeeekiayh commented 4 years ago

Hmmm, the files I downloaded are in a folder called flann-master. I don't see any file or folder with a name like flann-x.y.z. Might I have downloaded the wrong things? Or do I need to use other commands?

melhashash commented 4 years ago

@zeeekiayh just cd flann-master if this is your folder name

zeeekiayh commented 4 years ago

Okay, so I had done that originally, but it doesn't like the cmake command. I'm downloading it to make sure it works.

zeeekiayh commented 4 years ago

Okay, so cmake runs, but there are errors:

. . .
-- Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY) 
CMake Warning at CMakeLists.txt:120 (message):
  gtest library not found, some tests will not be run

. . .

-- Checking for module 'liblz4'
--   No package 'liblz4' found
CMake Error at /snap/cmake/372/share/cmake-3.17/Modules/FindPkgConfig.cmake:497 (message):
  A required package was not found
Call Stack (most recent call first):
  /snap/cmake/372/share/cmake-3.17/Modules/FindPkgConfig.cmake:681 (_pkg_check_modules_internal)
  CMakeLists.txt:150 (pkg_check_modules)

-- Configuring incomplete, errors occurred!

Should these (the missing files) be in the downloaded files from the flann repository?

WMF1997 commented 4 years ago

hello @zeeekiayh since you are now using ubuntu, then you can use sudo apt-get install liblz4-dev to install lz4. If you do not have sudo password, you can ask administrator for sudo password, or build lz4 by yourself. git clone https://github.com/lz4/lz4.git to get lz4, and build it by yourself... (and that is the case in lz4, not flann```

You may also lack some other libraries, for example, libhdf5. Just use apt-get to install it or build it by yourself. Since you are using C++, the MATLAB bindings and Python bindings can be ignored in CMakeLists.txt.

yours sincerely, @wmf1997

RealVincentBerthet commented 4 years ago

I have compiled Flann for Windows (debug and release) (using https://git.ircad.fr/conan/conan-flann it include patch for CPP17 support (removes deprecated std::binary_function and std::random_shuffle) if it could be usefull for you

flann_win_x86.zip

lukkio88 commented 1 year ago

@RealVincentBerthet although this is an old post. How did you compile the library? I am trying to compile it myself on windows but I get few missing dependencies.

I wonder if you can share the instructions? (And again I am aware this is an old post).

RealVincentBerthet commented 1 year ago

Well I don't remember.

It seems that we forked flann and patched it for C++17 to be able to compile it for our different platform using Conan. I apologize I don't have any other memories about it.