dlib android 识别时间,在android中使用dlib-19.4.0实时进行人脸识别

我遵循this github项目在android上加载dlib。我能够在我的android设备上运行这个东西。对于人脸检测和地标识别,它工作得很好。但我希望在我的应用中拥有面部识别功能,我可以在dlib-19.4.0中阅读。我甚至在python上试过它,它工作。

我想在我的android应用中导入这个功能。我按照说明构建.so文件。但在.so文件中,我找不到face_recognition的功能。你能帮我解决这个问题吗?这是我的CMAKE文件:

#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

cmake_minimum_required(VERSION 3.4.1)

message("Checking CMAKE_SYSTEM_NAME = '${CMAKE_SYSTEM_NAME}'")

if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

add_definitions(-DOS_OSX)

elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")

add_definitions(-DOS_LINUX)

elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")

add_definitions(-DOS_WIN)

elseif (${CMAKE_SYSTEM_NAME} MATCHES "Android")

add_definitions(-DOS_ANDROID)

message("Checking CMAKE_ABI_NAME = '${CMAKE_ANDROID_ARCH_ABI}'")

else()

message("OS not detected.")

endif()

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Werror")

## Define each subfolders

set(JNI_DETECTION_INCLUDE jni/jni_detections)

set(JNI_DETECTION_SRC jni/jni_detections)

set(JNI_COMMON_INCLUDE jni)

set(JNI_COMMON_SRC jni/jni_common)

set(DLIB_DIR dlib)

set(EXT_DIR third_party)

set(GLOG_INCLUDE_DIR ${EXT_DIR}/miniglog)

set(OPENCV_PREBUILT ${EXT_DIR}/OpenCV-android-sdk/sdk/native/jni)

# Opencv and it will use static import

set(ANDROID_NDK_ABI_NAME ${CMAKE_ANDROID_ARCH_ABI})

include(${OPENCV_PREBUILT}/OpenCVConfig.cmake)

# Include headers

include_directories(${DLIB_DIR} ${OpenCV_INCLUDE_DIRS} ${GLOG_INCLUDE_DIR} ${JNI_COMMON_INCLUDE} ${JNI_DETECTION_INCLUDE} include)

# Creates and names a library, sets it as either STATIC

# or SHARED, and provides the relative paths to its source code.

# You can define multiple libraries, and CMake builds it for you.

# Gradle automatically packages shared libraries with your APK.

add_library( # Sets the name of the library.

native-lib

# Sets the library as a shared library.

SHARED

# Provides a relative path to your source file(s).

# Associated headers in the same location as their source

# file are automatically included.

${DLIB_DIR}/dlib/cpp/cpp/native-lib.cpp

)

add_library(dlib.cpp

SHARED

${DLIB_DIR}/dlib/cpp/cpp/dlib.cpp

)

add_library(matrix.cpp

SHARED

${DLIB_DIR}/dlib/cpp/cpp/matrix.cpp

)

add_library(vector.cpp

SHARED

${DLIB_DIR}/dlib/cpp/cpp/vector.cpp

)

add_library(svm_c_trainer.cpp

SHARED

${DLIB_DIR}/dlib/cpp/cpp/svm_c_trainer.cpp

)

add_library(svm_rank_trainer.cpp

SHARED

${DLIB_DIR}/dlib/cpp/cpp/svm_rank_trainer.cpp

)

add_library(decision_functions.cpp

SHARED

${DLIB_DIR}/dlib/cpp/cpp/decision_functions.cpp

)

add_library(other.cpp

SHARED

${DLIB_DIR}/dlib/cpp/cpp/other.cpp

)

add_library(basic.cpp

SHARED

${DLIB_DIR}/dlib/cpp/cpp/basic.cpp

)

add_library(cca.cpp

SHARED

${DLIB_DIR}/dlib/cpp/cpp/cca.cpp

)

add_library(sequence_segmenter.cpp

SHARED

${DLIB_DIR}/dlib/cpp/cpp/sequence_segmenter.cpp

)

add_library(svm_struct.cpp

SHARED

${DLIB_DIR}/dlib/cpp/cpp/svm_struct.cpp

)

add_library(image.cpp

SHARED

${DLIB_DIR}/dlib/cpp/cpp/image.cpp

)

add_library(rectangles.cpp

SHARED

${DLIB_DIR}/dlib/cpp/cpp/rectangles.cpp

)

add_library(object_detection.cpp

SHARED

${DLIB_DIR}/dlib/cpp/cpp/object_detection.cpp

)

add_library(shape_predictor.cpp

SHARED

${DLIB_DIR}/dlib/cpp/cpp/shape_predictor.cpp

)

add_library(correlation_tracker.cpp

SHARED

${DLIB_DIR}/dlib/cpp/cpp/correlation_tracker.cpp

)

add_library(face_recognition.cpp

SHARED

${DLIB_DIR}/dlib/cpp/cpp/face_recognition.cpp

)

# Searches for a specified prebuilt library and stores the path as a

# variable. Because system libraries are included in the search path by

# default, you only need to specify the name of the public NDK library

# you want to add. CMake verifies that the library exists before

# completing its build.

find_library( # Sets the name of the path variable.

log-lib

# Specifies the name of the NDK library that

# you want CMake to locate.

log )

# Specifies libraries CMake should link to your target library. You

# can link multiple libraries, such as libraries you define in the

# build script, prebuilt third-party libraries, or system libraries.

target_link_libraries( # Specifies the target library.

native-lib

# Links the target library to the log library

# included in the NDK.

${log-lib} )

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值