android人脸识别SDK Demo

栏目: 编程工具 · 发布时间: 8年前

内容简介:android人脸识别SDK Demo

face-android-demo

人脸识别android-SDK V1.1 Relase 201701

add license control model

 /**
 * 获取android机器码(32位)
 * @return
 */
public native String getSerialNo();  // required
first

//get android device code 
String SerialNo = wisMobile.getSerialNo();

second 
send the code to vendor

third 
copy the license file to sd/wis directory

人脸识别android-SDK V1.0 Relase 20160716

人脸引擎的主要sdk以动态链接库方式提供.为帮助开发者,我们提供了 java 的封装api(com.wis.face.WisMobile),供大家使用.

人脸引擎相关的文件有

WisFaceDemo4Android/app/src/main/jniLibs/armeabi/libcaffe.so
WisFaceDemo4Android/app/src/main/jniLibs/armeabi/libwis_engine_jni.so
wis/fdetector_model.dat
wis/file1-proto
wis/file2-model
wis/model_small.xml.gz

demo使用的android的版本为:4.4+ ,使用者可以自行调整android版本号进行编译打包.

目前人脸sdk使用的android NDK 版本4.4+, 4.4以下没有测试,开发者自行测试.

使用说明

1.其中

1.1 wis文件夹拷贝至android 设备的 /sdcard/

例如/sdcard/wis

2.人脸识别javaAPI通用类为: com.wis.face.WisMobile

主要使用的比对函数如下:

/**
 * 两张人脸照片进行比对,返回相似度(0~1)之间, 如果大于0.5就代表很相似,如果超过0.9表示两个照片属于同一个人的概率极大
 * @return
 */

public float calculate2ImageSimilarity(String imgFile1,String imgFile2);

3.API使用demo间 face.wis.wisfacedemo4android.MainActivity

其中,demo()函数完成了两个照片的比对工作.

private void demo()
{
    String fileName1 = "/sdcard/wis/images/1.jpg";
    String fileName2 = "/sdcard/wis/images/2.jpg";
    //compare 2 faces 
    float score = wisMobile.calculate2ImageSimilarity(fileName1, fileName2);
    Log.i("face", "Similarity Score=" + score);
}

4.详细使用参考: WisFaceDemo4Android 基于android-studio2.1开发的demo示例

运行demo打印结果如下:

11-30 16:10:38.294 17686-17686/com.wis I/wisMobile: detect time  1585
11-30 16:10:38.294 17686-17686/com.wis I/wisMobile: detectFace num =1,rect(x,y,width,height) = 31,67,145,145
11-30 16:10:38.599 17686-17686/com.wis I/wisMobile: extractFeature time  305521
11-30 16:10:38.600 17686-17686/com.wis I/wisMobile: detect time  283
11-30 16:10:38.600 17686-17686/com.wis I/wisMobile: detectFace num =1,rect(x,y,width,height) = 5,19,90,90
11-30 16:10:38.868 17686-17686/com.wis I/wisMobile: extractFeature time  267347
11-30 16:10:38.868 17686-17686/com.wis I/wisMobile: score   0.9999
11-30 16:10:38.868 17686-17686/com.wis I/face: Similarity Score=0.9999

其中, Similarity Score=0.9999 就是两个wis/images/1.jpg,2.jpg两个人脸照片的相似度

提示:sdk初始化,wisMobile.loadModel(modelDir);需要读取 "/sdcard/wis" 下的model文件. 所以android应用开发需要给

<!-- 操作sd卡权限 -->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

以上所述就是小编给大家介绍的《android人脸识别SDK Demo》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

RESTful Web Services Cookbook

RESTful Web Services Cookbook

Subbu Allamaraju / Yahoo Press / 2010-3-11 / USD 39.99

While the REST design philosophy has captured the imagination of web and enterprise developers alike, using this approach to develop real web services is no picnic. This cookbook includes more than 10......一起来看看 《RESTful Web Services Cookbook》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具