Face++人脸识别
2017-03-12 23:10
211 查看
最近看到一个视频关于人脸识别,于是就测试了一番,千百度一番没有找到好的源码,
幸好Face++官方有源码,而且注释写的特别详细,我就研究了一天,终于皇天不负有心人,我成功的写出 了第一个人脸识别项目
这是部分代码:
源码已上传至github
地址为:https://github.com/systemmin/Face.git
幸好Face++官方有源码,而且注释写的特别详细,我就研究了一天,终于皇天不负有心人,我成功的写出 了第一个人脸识别项目
这是部分代码:
String str=null; | |
ByteArrayOutputStream output= null; | |
FileImageInputStream input= null; | |
byte bys[] = new byte[4000]; | |
try { | |
input = new FileImageInputStream(newFile(path)); | |
output = new ByteArrayOutputStream(); | |
byte[] buf = new byte[4000]; | |
int numBytesRead = 0; | |
while ((numBytesRead = input.read(buf)) != -1) { | |
output.write(buf, 0, numBytesRead); | |
} | |
bys = output.toByteArray(); | |
} catch (FileNotFoundException e1) { | |
e1.printStackTrace(); | |
System.err.println("系统找不到指定的路径"); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} finally { | |
try { | |
output.close(); | |
input.close(); | |
} catch (Exception e2) { | |
e2.printStackTrace(); | |
} | |
} | |
/* | |
*调用Face++接口CommonOperate对象需要传入三个参数 | |
*第一个apiKey | |
*第二个apiSecret | |
*第三个isInternationalVersion 是否是使用国际版 | |
*response.getStatus()返回状态码,状态这里可以查到 | |
*https://console.faceplusplus.com.cn/documents/5672651 | |
*response.getContent()返回参数,是字节数组,转成String输出JSON串 | |
*/ | |
CommonOperate iOperate = new CommonOperate( | |
"PDr8aqmZFWMvkFFtUNx_PFrbwi-j_Etx", | |
"Ek54PzZn7au29e2TAUxlOzwOSfqNubps",false); | |
try { | |
Response response = iOperate.detectByte(bys,1, "gender,age,smiling,glass,headpose,blur"); | |
if (response.getStatus()==200) { | |
str = new String(response.getContent()); | |
}else{ | |
str = ""; | |
} | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
return str; | |
} |
地址为:https://github.com/systemmin/Face.git
相关文章推荐
- 人脸识别经典算法三:Fisherface(LDA)
- 人脸识别之SphereFace
- FaceNet--Google的人脸识别
- 前端人脸识别框架Tracking.js与JqueryFaceDetection
- 【学习日记】人脸识别FaceNet之深度卷积网络NN2解读
- 人脸识别“SphereFace: Deep Hypersphere Embedding for Face Recognition”
- Investigation of uncooled infrared imagery for face recognition(用于人脸识别的非制冷红外成像研究)
- 人脸识别经典算法三:Fisherface(LDA)
- 人脸识别之特征脸识别方法EigenFace
- python Windows install face_recognition 人脸识别库
- face_recognition开源人脸识别库:离线识别率高达99.38%
- 人脸和手势识别数据集 FGnet - IST-2000-26434 Face and Gesture Recognition Working group
- 采访 | 苹果菲尔·席勒:Face ID非常独特 其他家的人脸识别都很糟糕
- FaceNet--Google的人脸识别
- 人脸识别经典算法三:Fisherface(LDA)
- face++实现人脸识别
- 经典人脸识别算法小结——EigenFace, FisherFace & LBPH(下)
- DeepFace--Facebook的人脸识别
- [人脸识别]使用VGG Face Model对一张图片进行测试
- CentOS7安装face_recognition人脸识别库