See http://dlib.net for the main project documentation.
See dlib-android for JNI lib. Refer to dlib-android/jni/jnilib_ex
$ git clone https://github.com/tzutalin/dlib-android-app.git
Support HOG detector
HOG Face detection
Facial Landmark/Expression
Open Android studio to build
Use command line to build (Optional)
On Windows platforms, type this command:
$ gradlew.bat assembleDebug
On Mac OS and Linux platforms, type these commands:
$ ./gradlew assembleDebug
or
$ make ; make install
You can build shared library from dlib-android
Copy the shared library to ./dlib/src/main/jniLibs/
Download and install the apk
$ adb install demo/app-debug.apk
Otherwise, import the library to your build.gradle
repositories {
maven {
url 'https://dl.bintray.com/tzutalin/maven'
}
}
dependencies {
implementation 'com.tzutalin.dlib-android-app:dlib:1.0.4'
}
Facial landmark detection
FaceDet faceDet = new FaceDet(Constants.getFaceShapeModelPath());
Bitmap bitmap = BitmapFactory.decodeFile("Image Path");
List<VisionDetRet> results = faceDet.detect(bitmap);
for (final VisionDetRet ret : results) {
String label = ret.getLabel();
int rectLeft = ret.getLeft();
int rectTop = ret.getTop();
int rectRight = ret.getRight();
int rectBottom = ret.getBottom();
// Get 68 landmark points
ArrayList<Point> landmarks = ret.getFaceLandmarks();
for (Point point : landmarks) {
int pointX = point.x;
int pointY = point.y;
}
}
Pedestrian detection
Pedestrian pedestrianDet = new PedestrianDet();
List<VisionDetRet> personList = pedestrianDet.detect(imgPath);