LYNX

Links

Tags

Categories

vlfeat笔记

cpp(Linux)

官方C API

参考:https://www.vlfeat.org/gcc.html

/etc/ld.so.conf.d/下任意一个文件(如opencv.conf)添加so库的路径,然后sudo ldconfig

extern "C" {
#include
}

int main (int argc, const char * argv[]) {
VL_PRINT ("Hello world!") ;
return 0;
}
g++ vl_test.cpp -o test -I$(VL) -L$(VL)/bin/glnxa64 -lvl

编译

单独使用sift模块

使用源文件

  1. 保留vl目录下所有文件

  2. 保留src下的sift.cgeneric-driver.h

  3. 注释host.h部分代码(约665行)

    /* Linux: limit glibc to old versions for compatibility */
    // #if defined(VL_COMPILER_GNUC) & defined(VL_OS_LINUX) & ! defined(__DOXYGEN__)
    // __asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
    // #endif
  4. vl下创建一个头文件fuck.h

    #define FUCK_H

    #define VL_DISABLE_AVX
    #define VL_DISABLE_SSE2
  5. vl下的host.h,imopv_sse2.c头部添加

    #if ! defined(FUCK_H)
    #include "fuck.h"
    #endif
  6. CMakeLists.txt编写

    # vlfeat
    set(vlfeat_dir /home/lynx/fuck_mount/vlfeat/vlfeat_android)
    include_directories(${vlfeat_dir})
    aux_source_directory(/home/lynx/fuck_mount/vlfeat/vlfeat_android/src vl_src)
    aux_source_directory(/home/lynx/fuck_mount/vlfeat/vlfeat_android/vl vl_head)
    add_library(
    vlfeat_lib

    SHARED

    ${vl_src}
    ${vl_head}
    )

    # 添加目标文件/目标库
    add_executable(
    entry

    source.cpp )

    # 连接库文件
    target_link_libraries(
    entry

    ${OpenCV_LIBS}
    # ${vlfeat_lib}
    vlfeat_lib
    )

常见错误

  1. 找不到libiomp5.so
apt-file search libiomp5.so
sudo apt install libomp-7-dev

Tags

Categories

1 / 1