Skip to content

Instantly share code, notes, and snippets.

View tcw165's full-sized avatar
💭
building AI

TC Wang tcw165

💭
building AI
View GitHub Profile
void onSelectionChanged(List<IPhoto> list,
IPhoto added,
IPhoto removed,
IPhoto updated) {
// Go through the sub-set of the adapter to compare the element with the changed
// item.
// Find the position of first visible item.
final int first = mPhotoListLayoutMgr.findFirstVisibleItemPosition();
// Find the position of last visible item.
cd examples && mkdir build && cd build && cmake .. && cmake — build .
# 1st parameter is the trained model; 2nd parameter is the photo
./face_landmark_detection_ex \
shape_predictor_68_face_landmarks.dat \
../faces/*.jpg
# Env variable for Android SDK.
export ANDROID="$HOME/Library/Android/sdk"
export ANDROID_HOME="$HOME/Library/Android/sdk"
# Env variable for Android NDK.
export ANDROID_NDK="$HOME/Library/Android/sdk/ndk-bundle"
export ANDROID_NDK_HOME="$HOME/Library/Android/sdk/ndk-bundle"
# Env variable for Android cmake.
export ANDROID_CMAKE="$ANDROID_HOME/cmake/3.6.3155560/bin/cmake"
# --arch {arm,arm64,mips,mips64,x86,x86_64}
# --api API Target the given API version (example: "--api 24").
# --stl {gnustl,libc++,stlport}
# C++ STL to use.
# --install-dir INSTALL_DIR
# Install toolchain to the given directory instead of
# packaging.
$ANDROID_NDK/build/tools/make_standalone_toolchain.py \
--stl libc++ \
--arch arm --api 16 \
# Step 1. Switch to the release commit. For example: v19.4.
git checkout v19.4
# Step 2. Create the build folder for storing generated files.
cd dlib && mkdir build-armeabi-v7a && cd build-armeabi-v7a;
# Step 3. Use CMake to generate the Makefile.
# -DCMAKE_INSTALL_PREFIX Because it's a cross-compiled library. You probably
# want to install the header files and shared library
# in specific folder rather than default /usr/local
# Copyright (C) 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# Step 1. Check out the release branch or commit.
git checkout v3.2.0
# Step 2. Create build-armeabi-v7a folder for storing generated files.
cd cmake && mkdir build-armeabi-v7a && cd build-armeabi-v7a
# Step 3. Generate Makefile with CMake.
# -Dprotobuf_BUILD_SHARED_LIBS=ON By default is static library (*.a file). I want a
# shared library (*.so file).
# -DCMAKE_INSTALL_PREFIX Because it's a cross-compiled library. You probably
public class DlibModelHelper {
private static final String BASE_URL = "http://dlib.net/files/";
private static final String FACE68_ZIP_FILE = "shape_predictor_68_face_landmarks.dat.bz2";
private static final String FACE68_FILE = "shape_predictor_68_face_landmarks.dat";
private static final String PREF_KEY_FACE68_ZIP = FACE68_ZIP_FILE;
private static DlibModelHelper sSingleton = null;