alicevision/popsift

How to use popsift as API?

Opened this issue · 3 comments

Hello @simogasp ,
I have downloaded and build popsift in ubuntu 22.04 and it working fine when i am using popsift-demo to find features but i am unable to use it as an API. Could you please suggest the proper way of using popsift as API.
Thank you.

You have just to adapt the popsift-demo code inside your project.
You can also check how for example popsift is used inside alicevision, embedded in a class that performs the feature detection https://github.com/alicevision/AliceVision/blob/develop/src/aliceVision/feature/sift/ImageDescriber_SIFT_popSIFT.hpp

If you need to add popsift to your cmake project you can just check the documentation
https://popsift.readthedocs.io/en/latest/install/install.html#popsift-as-third-party

Hello @simogasp
I am trying to use popsift as third party in my local file (main.cpp) with the following details :

CMakeLists.txt file is :

cmake_minimum_required(VERSION 3.0)

project(PopSift)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)

# Find the package from the PopSiftConfig.cmake
# in <prefix>/lib/cmake/PopSift/. Under the namespace PopSift::
# it exposes the target popsift that allows you to compile
# and link with the library
find_package(PopSift CONFIG REQUIRED)

# suppose you want to try it out in a executable
add_executable(poptest main.cpp)
# add link to the library
target_link_libraries(poptest PUBLIC PopSift::popsift)

and while configuring using command : cmake .. -DPopSift_DIR=/home/surveyaan/sagar/popsift/build/src/generated/

I am getting the following error :

CMake Error at CMakeLists.txt:15 (add_executable):
  Target "poptest" links to target "PopSift::popsift" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.

and while configuring using command : cmake .. -DPopSift_DIR=/home/surveyaan/sagar/popsift/build/src/generated/

You should avoid using intree build. First install popsift in a directory of your preference (NOT a system one like /usr/local) and then make PopSift_DIR point to that location.
E.g.

# in popsift build directory do
cmake .. -DCMAKE_INSTALL_PREFIX=`pwd`/install
make install

# then in your sample application do
cmake  .. -DPopSift_DIR=/home/surveyaan/sagar/popsift/build/install

Also note that if you are using a CUDA > 8 then the c++ standard used by popsift is 14.