Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了dlib-android大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

 

https://travis-ci.org/tzutalin/dlib-android

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

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

 

https://www.cnblogs.com/ywjfx/p/10004564.html

终极Android.mk模板,遍历头文件和源文件目录

https://blog.csdn.net/as929015918/article/details/78885094

build.txt

export ANDROID_NDK_HOME=/DATA/Android/Ndk/android-ndk-r13b
export PATH=$PATH:$ANDROID_NDK_HOME


Error:Could not find com.android.support:appcompat-v7:25.3.1.
required by:
    project :app
    project :app > project :dlib

Please install the Android Support Repository from the Android SDK Manager.
<a href="openAndroidSdkManager">Open Android SDK Manager</a>



Error:A problem occurred configuring project :app.
> Could not resolve all dependencies for configuration :app:_debugApk.
   > A problem occurred configuring project :dlib.
      > Could not resolve all dependencies for configuration :dlib:_debugPublishCopy.
         > Could not find com.android.support:appcompat-v7:25.3.1.
           required by:
               project :dlib
         > Could not find com.android.support:support-Annotations:25.3.1.
           required by:
               project :dlib


第一次编译步骤
./envsetup
python build.py
cp -r libs/* ../dlib-android-app/dlib/src/main/jniLibs

后面的编译
python build.py
或者ndk-build -j 2
cp -r libs/* ../dlib-android-app/dlib/src/main/jniLibs


libandroid_dlib.so

 

Readme

# dlib-android

[![Build Status](https://travis-ci.org/tzutalin/dlib-android.png)](https://travis-ci.org/tzutalin/dlib-android)

### Purpose
* Port [dlib](http://dlib.net/) to Android platform

* You can build it to dynamic or static library for Android. You can also build dlib‘s sample to Android executable file.

* You can refer to [dlib-android-app](https://github.com/tzutalin/dlib-android-app) which demonstrates dlib-android features

### Grab the source

$ git clone --recursive https://github.com/tzutalin/dlib-android.git
$ cd dlib-android
$ ./envsetup

### Prerequisites
* Download Android-NDK from [Android website](https://developer.android.com/ndk/downloads/index.html).

After downloading,go to the directory to which you downloaded the package to extract it

Export ANDROID_NDK_HOME in ~/.bashrc
`$ vim ~/.bashrc`

`export ANDROID_NDK_HOME=[NDK_PATH]/android-ndk-[version]`

`export PATH=$PATH:$ANDROID_NDK_HOME`

* Install Android Debug Bride (ADB). you can download it via [Android SDK Manager](https://developer.android.com/sdk/installing/index.html) or $ sudo apt-get install android-tools-adb

* Prepare an Android device for test

### Build JNI code and shared library for Android application
* You can change the compiler architecture in dlib-android/jni/Application.mk

* The way to build the shared library for Android application

```sh
$ cd [dlib-android]
$ python build.py
```

Alternative way to build native code and copy to the Android studio‘s project manually:
```sh
$ cd [dlib-android]
$ ndk-build -j 2
$ cp -r libs/* androidstudio-examples/dlib-android-app/dlib/src/main/jniLibs
```

### Run Android application
* Open Android studio‘s projects in androidstudio-examples/dlib-android-app to run face detection,face landmark,and so on

### Folder structure

```
├── data # Test data or the models for detection and landmarks
├── dlib # source files of dlib. it is a submodule
├── jni # source files of JNI codes and their make files
├── androidstudio-examples # Android studio‘s projects use the shared library built by this repo
├── tools # Tools and utilities
├── third_party # Like OpenCV and [miniglog](https://github.com/tzutalin/miniglog)
├── CMakeLists.txt # Use CMake to build instead of using Android.mk
├── LICENSE
└── README.md
```

### Do you want to contribute
* If you have any improvement or you‘ve found any bug,send a pull request with the code.
* Give me a star on this repository
* <a href=‘https://ko-fi.com/A4263TV2‘ target=‘_blank‘><img height=‘36‘ style=‘border:0px;height:36px;‘ src=‘https://az743702.vo.msecnd.net/cdn/kofi1.png?v=0‘ border=‘0‘ alt=‘Buy Me a Coffee at ko-fi.com‘ /></a>

### Future tasks
* Add more examples to [dlib-android-app](https://github.com/tzutalin/dlib-android-app)

 

 

CmakeList

cmake_minimum_required(VERSION 3.4.1)

message("checking CMAKE_SYstem_NAME = ‘${CR_732_11845@AKE_SYstem_NAME}")
if (${CR_732_11845@AKE_SYstem_NAME} MATCHES "Darwin")
  add_deFinitions(-DOS_OSX)
elseif (${CR_732_11845@AKE_SYstem_NAME} MATCHES "Linux")
  add_deFinitions(-DOS_LINUX)
elseif (${CR_732_11845@AKE_SYstem_NAME} MATCHES "Windows")
  add_deFinitions(-DOS_WIN)
elseif (${CR_732_11845@AKE_SYstem_NAME} MATCHES "Android")
  add_deFinitions(-DOS_ANDROID)
  message("checking CMAKE_ABI_NAME = ‘${CR_732_11845@AKE_ANDROID_ARCH_ABI}‘")
else()
  message("OS not detected.")
endif()

set(CMAKE_CXX_FLAGS "${CR_732_11845@AKE_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}/@H_824_26@miniglog)
set(OPENCV_PREBUILT ${EXT_DIR}/OpenCV-android-sdk/sdk/native/jni)

# Opencv and it will use static import
set(ANDROID_NDK_ABI_NAME ${CR_732_11845@AKE_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)

add_library(android_dlib SHARED
            ${JNI_DETECTION_SRC}/jni_face_det.cpp
            ${JNI_DETECTION_SRC}/jni_iR_732_11845@ageutils.cpp
            ${JNI_DETECTION_SRC}/jni_pedeStrian_det.cpp
            ${JNI_COMMON_SRC}/jni_bitmap2mat.cpp
            ${JNI_COMMON_SRC}/jni_fileutils.cpp
            ${JNI_COMMON_SRC}/jni_utils.cpp
            ${JNI_COMMON_SRC}/rgb2yuv.cpp
            ${JNI_COMMON_SRC}/yuv2rgb.cpp
            ${DLIB_DIR}//dlib/threads/threads_kernel_shared.cpp
            ${DLIB_DIR}/dlib/entropy_decoder/entropy_decoder_kernel_2.cpp
            ${DLIB_DIR}/dlib/base64/base64_kernel_1.cpp
            ${DLIB_DIR}/dlib/threads/threads_kernel_1.cpp
            ${DLIB_DIR}/dlib/threads/threads_kernel_2.cpp
            ${EXT_DIR}/miniglog/glog/logging.cC)

target_link_libraries(android_dlib
                      android
                      jnigraphics
                      z
                      m
                      dl
                      log)

大佬总结

以上是大佬教程为你收集整理的dlib-android全部内容,希望文章能够帮你解决dlib-android所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:androiddlib