Using dlib-19.4.0 in android for realtime face recognition

I followed this github project for dlib download on android. I was able to run this thing on my android device. For face recognition and sign recognition, it worked fine. But I want to have a face recognition feature in my application that I am reading, possibly in dlib-19.4.0. I even tried it in python and it worked.

I want to import this function into my android app. I followed the instructions to build the .so files. But in the .so files, I couldn't find the face_recognition functions. Could you please help me with this. Here is my CMAKE file:

#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
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} )

      

+3
android android-studio android-ndk face-recognition dlib


source to share


No one has answered this question yet

Check out similar questions:

3606
Close / hide Android soft keyboard
3295
Why is the Android emulator so slow? How can we speed up the development of an Android emulator?
3288
Correct use cases for Android UserManager.isUserAGoat ()?
2609
Is there a unique identifier for an Android device?
2510
How to persist android activity state by persisting instance state?
2097
Is there a way to run Python on Android?
1844
What is "Context" on Android?
1345
Where can I put the "assets" folder in Android Studio?
1214
Rename package in Android Studio
1206
What is Gradle in Android Studio?



All Articles
Loading...
X
Show
Funny
Dev
Pics