usnistgov / NFIQ2

Optical live-scan and ink fingerprint image quality assessment tool
https://www.nist.gov/services-resources/software/development-nfiq-20
Other
128 stars 56 forks source link

Support Ubuntu 22.04 #347

Open imlegend19 opened 1 year ago

imlegend19 commented 1 year ago

Hi, I am facing issues in executing the example scripts. I also want to make changes to the NFIQ2 codebase for a custom requirement but was not able to successfully setup the code on Ubuntu 22.04 (Tried on CLion & VSCode).

Steps to reproduce the issue:

  1. Install https://github.com/usnistgov/NFIQ2/releases/download/v2.2.0/nfiq2-dev_2.2.0-1_amd64.deb.
  2. Create a new C++ project. CMakeLists.txt as follows (ref):
CMakeLists.txt ```cmake cmake_minimum_required(VERSION 3.24) project(Test) set(CMAKE_CXX_STANDARD 17) set(NFIQ2_INSTALL_DIR /usr/local/nfiq2/lib) include_directories(/usr/local/nfiq2/include) set(REQUIRED_LIBS "") find_library(LIBNFIQ2_STATIC ${CMAKE_STATIC_LIBRARY_PREFIX}nfiq2${CMAKE_STATIC_LIBRARY_SUFFIX} PATHS ${NFIQ2_INSTALL_DIR} REQUIRED) find_library(LIBOPENCV_CORE_STATIC ${CMAKE_STATIC_LIBRARY_PREFIX}opencv_core${CMAKE_STATIC_LIBRARY_SUFFIX} PATHS ${NFIQ2_INSTALL_DIR} REQUIRED) find_library(LIBOPENCV_IMGPROC_STATIC ${CMAKE_STATIC_LIBRARY_PREFIX}opencv_imgproc${CMAKE_STATIC_LIBRARY_SUFFIX} PATHS ${NFIQ2_INSTALL_DIR} REQ0UIRED) find_library(LIBOPENCV_ML_STATIC ${CMAKE_STATIC_LIBRARY_PREFIX}opencv_ml${CMAKE_STATIC_LIBRARY_SUFFIX} PATHS ${NFIQ2_INSTALL_DIR} REQ0UIRED) find_library(LIBFRFXLL_STATIC ${CMAKE_STATIC_LIBRARY_PREFIX}FRFXLL_static${CMAKE_STATIC_LIBRARY_SUFFIX} PATHS ${NFIQ2_INSTALL_DIR} REQUIRED) find_library(LIBNFIR_STATIC ${CMAKE_STATIC_LIBRARY_PREFIX}nfir${CMAKE_STATIC_LIBRARY_SUFFIX} PATHS ${NFIQ2_INSTALL_DIR} REQUIRED) list(APPEND REQUIRED_LIBS ${LIBNFIQ2_STATIC} ${LIBOPENCV_CORE_STATIC} ${LIBOPENCV_IMGPROC_STATIC} ${LIBOPENCV_ML_STATIC} ${LIBFRFXLL_STATIC} ${LIBNFIR_STATIC}) set(ALL_TARGETS "") add_executable(main main.cpp) target_link_libraries(main ${REQUIRED_LIBS}) set_target_properties(main PROPERTIES MACOSX_RPATH YES CXX_STANDARD 11 CXX_STANDARD_REQUIRED YES CXX_EXTENSIONS NO) list(APPEND ALL_TARGETS main) ```
  1. Create main.cpp:
    
    #include <nfiq2.hpp>

include

int main() { std::cout << "NFIQ 2 Features:\n"; for (const auto &features: NFIQ2::QualityFeatures::getQualityFeatureIDs()) { std::cout << " * " << features << '\n'; }

return (EXIT_SUCCESS);

}


I am getting this [error](https://github.com/usnistgov/NFIQ2/files/10384385/error.txt) on building `main.cpp`.

Ideally I want to install NFIQ2 from source to make the changes in the code. I followed the exact steps mentioned in the README.md but no luck. CLion does not index the header files.

**OS information**
- OS: Ubuntu
- Version: 22.04

**Library information**
- C++ library
- Static library
gfiumara commented 1 year ago

The .deb file you linked to is built for Ubuntu 20.04, not 22.04. The static libs in the package are likely relying on symbols from system libraries that are not present in 22.02. We'd need to rebuild and repackage for 22.04. I do not have hardware to perform the required large-scale regression test on 22.04 amd64 or arm64 at this time, but I can confirm this compiles cleanly following the instructions in the README and runs the conformance test successfully on 22.04.

I can't comment on how successful you can be with CLion with the NFIQ2's current CMake config. Improvements there are noted in other issues (e.g., #122). However, you can follow the example from the examples/ dir, resetting NFIQ2_INSTALL_DIR for where you built NFIQ2. For example, cmake -DNFIQ2_INSTALL_DIR=<# PATH_TO_CMAKE_BUILD_DIR #>/install_staging/nfiq2 .. && make.

I'll update this issue to support 22.04.