先贴一段代码,后续再更新
long matAddr = frame.getNativeObjAddr();
System.err.println("matAddr=======" + matAddr);
int maxFace = 1; // 检测最大人脸数
//获取检测人员信息
TrackFaceInfo[] infos = Face.trackByMat(matAddr, maxFace);
//不等null则检测到人脸
if (infos != null) {
int size = infos.length;
System.out.println("size====" + size);
for (int i = 0; i < size; i++) {
TrackFaceInfo info = infos[i];
RotatedRect box = ShowVideo.boundingBox(info.landmarks, info.landmarks.length);
ShowVideo.drawRotatedBox(frame, box, new Scalar(0, 255, 0));
//获取人脸质量,转为json对象,获取质量值
String arr = Face.faceQualityByMat(matAddr);
JSONObject json = new JSONObject(arr);
System.out.println("json===" + json);
double illum = Double.parseDouble(json.getJSONObject("data").getJSONObject("result").getString("illum"));
System.out.println("人脸质量=====" + arr);
//质量值大于70,获取人脸特征值,存入人脸库
if (illum > 70) {
byte[] bytes = Face.getFaceFeatureByMat(matAddr);
String addInfo = Face.userAddByFeature("3002", "001", bytes, bytes.length, "10001");
System.err.println("addInfo=======" + addInfo);
JSONObject infoJson = new JSONObject(addInfo);
String msg = infoJson.getString("msg");
if(msg.equals("success")){
}