增加心跳处理人脸数据增减
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.sw.plate.utils.arcface;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.arcsoft.face.FaceEngine;
|
||||
@@ -79,4 +80,26 @@ public class FaceApi {
|
||||
// List<FacePreviewInfo> facePreviewInfoList = recognizeViewModel.onPreviewFrame(nv21, true);
|
||||
return null;
|
||||
}
|
||||
|
||||
public void deleteByUserName(String userName) {
|
||||
FaceDao faceDao = FaceDatabase.getInstance(App.getContext()).faceDao();
|
||||
faceDao.deleteFaceById(userName);
|
||||
}
|
||||
|
||||
public Long insert(FaceEntity entity) {
|
||||
if (entity == null) {
|
||||
return 0L;
|
||||
}
|
||||
FaceDao faceDao = FaceDatabase.getInstance(App.getContext()).faceDao();
|
||||
return faceDao.insert(entity);
|
||||
}
|
||||
|
||||
public FaceEntity queryByUserName(String userName) {
|
||||
if (TextUtils.isEmpty(userName)) {
|
||||
return null;
|
||||
}
|
||||
FaceDao faceDao = FaceDatabase.getInstance(App.getContext()).faceDao();
|
||||
return faceDao.queryByUserName(userName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -88,4 +88,7 @@ public interface FaceDao {
|
||||
|
||||
@Query("UPDATE sqlite_sequence SET seq = 0 WHERE name ='face'")
|
||||
void resetId();
|
||||
|
||||
@Query("SELECT * FROM face WHERE user_name = :userName limit 1")
|
||||
FaceEntity queryByUserName(String userName);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@ public class FaceEntity implements Parcelable {
|
||||
@ColumnInfo(name = "register_time")
|
||||
private long registerTime;
|
||||
|
||||
|
||||
public FaceEntity(String userName, String imagePath, byte[] featureData) {
|
||||
this.userName = userName;
|
||||
this.imagePath = imagePath;
|
||||
|
||||
@@ -60,6 +60,10 @@ public class FaceServer {
|
||||
faceRegisterInfoList = new ArrayList<>();
|
||||
}
|
||||
|
||||
public FaceEngine getFaceEngine() {
|
||||
return faceEngine;
|
||||
}
|
||||
|
||||
public static FaceServer getInstance() {
|
||||
if (faceServer == null) {
|
||||
synchronized (FaceServer.class) {
|
||||
|
||||
Reference in New Issue
Block a user