ndk编译dlib并给活体检测Face-Liveness_detection使用

https://github.com/zj19941113/Face-Liveness_detection

首先,导入ndk的环境变量,

参考https://blog.csdn.net/sun007700/article/details/97649694

 

 

mkdir ndk_build
deyi@deyi-virtual-machine:~/code/face_Liveness_detection/Face-Liveness_detection$ cd ndk_build/
deyi@deyi-virtual-machine:~/code/face_Liveness_detection/Face-Liveness_detection/ndk_build$  cmake  ..

ndk_build$  cmake  ..
-- The C compiler identification is GNU 4.9.0
-- The CXX compiler identification is GNU 4.9.0
-- Check for working C compiler: /opt/android-toolchain-r16b/android-armv7/bin/arm-linux-androideabi-gcc
-- Check for working C compiler: /opt/android-toolchain-r16b/android-armv7/bin/arm-linux-androideabi-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /opt/android-toolchain-r16b/android-armv7/bin/arm-linux-androideabi-g++
-- Check for working CXX compiler: /opt/android-toolchain-r16b/android-armv7/bin/arm-linux-androideabi-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using CMake version: 3.10.2
-- Compiling dlib version: 19.16.0
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE  
 *****************************************************************************
 *** DLIB GUI SUPPORT DISABLED BECAUSE X11 DEVELOPMENT LIBRARIES NOT FOUND ***
 *** Make sure libx11-dev is installed if you want GUI support.            ***
 *** On Ubuntu run: sudo apt-get install libx11-dev                        ***
 *****************************************************************************
-- Searching for BLAS and LAPACK
-- Searching for BLAS and LAPACK
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'cblas'
--   No package 'cblas' found
-- Checking for module 'lapack'
--   Found lapack, version 0.2.20+ds
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void*
-- Check size of void* - done
-- Found Intel MKL BLAS/LAPACK library
-- Looking for sgesv
-- Looking for sgesv - not found
-- Looking for sgesv_
-- Looking for sgesv_ - not found
CUDA_TOOLKIT_ROOT_DIR not found or specified
-- Could NOT find CUDA (missing: CUDA_TOOLKIT_ROOT_DIR CUDA_NVCC_EXECUTABLE CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY) (Required is at least version "7.5")
-- Disabling CUDA support for dlib.  DLIB WILL NOT USE CUDA
-- C++11 activated.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/deyi/code/face_Liveness_detection/Face-Liveness_detection/ndk_build
deyi@deyi-virtual-machine:~/code/face_Liveness_detection/Face-Liveness_detection/ndk_build$ 


上边在linux环境下编译报错,不太好折腾。换个思路

Android开发——Android Studio下使用Cmake在NDK环境下移植Dlib库

https://blog.csdn.net/u012525096/article/details/78950979

上边这个例子编译有一定的问题需要修改makelist.txt,参考

https://blog.csdn.net/sun007700/article/details/97499236

#编译dlib
add_library(
        dlib
        SHARED
        ${pathToDlib}/dlib/all/source.cpp
)
 
add_library(
        liveness
        SHARED
        ${SRCS}
)
 
 
 
target_link_libraries(
        liveness
        log
        jnigraphics
        #链接动态库 使用完整路径
        ${PROJECT_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/libdlib.so
)

另外需要吧这个地方注释掉,编译/dlib/all/source.cpp报错的时候

//#ifndef DLIB_NO_GUI_SUPPORT
//#include "../gui_widgets/fonts.cpp"
//#include "../gui_widgets/widgets.cpp"
//#include "../gui_widgets/drawable.cpp"
//#include "../gui_widgets/canvas_drawing.cpp"
//#include "../gui_widgets/style.cpp"
//#include "../gui_widgets/base_widgets.cpp"
//#include "../gui_core/gui_core_kernel_1.cpp"
//#include "../gui_core/gui_core_kernel_2.cpp"
//#endif // DLIB_NO_GUI_SUPPORT

 

还有一个思路,这个没也尝试,有兴趣的小伙伴可以试试。

https://github.com/tzutalin/dlib-android

dlib-android编译

https://blog.csdn.net/forest_world/article/details/78147484

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值