|
@@ -2,7 +2,6 @@ package com.sunwin.visitorapp.view;
|
|
|
|
|
|
import android.app.Activity;
|
|
import android.app.Activity;
|
|
import android.content.Context;
|
|
import android.content.Context;
|
|
-import android.graphics.Bitmap;
|
|
|
|
import android.graphics.Rect;
|
|
import android.graphics.Rect;
|
|
import android.hardware.Camera;
|
|
import android.hardware.Camera;
|
|
import android.os.Build;
|
|
import android.os.Build;
|
|
@@ -17,6 +16,7 @@ import com.sunwin.visitorapp.BaseApplication;
|
|
import com.sunwin.visitorapp.R;
|
|
import com.sunwin.visitorapp.R;
|
|
import com.sunwin.visitorapp.camera.CameraHolder;
|
|
import com.sunwin.visitorapp.camera.CameraHolder;
|
|
import com.sunwin.visitorapp.camera.CameraSurfaceView;
|
|
import com.sunwin.visitorapp.camera.CameraSurfaceView;
|
|
|
|
+import com.sunwin.visitorapp.face.CameraPreviewData;
|
|
import com.sunwin.visitorapp.face.FRAbsLoop;
|
|
import com.sunwin.visitorapp.face.FRAbsLoop;
|
|
import com.sunwin.visitorapp.face.FRAbsLoopFactory;
|
|
import com.sunwin.visitorapp.face.FRAbsLoopFactory;
|
|
import com.sunwin.visitorapp.model.OpenDoorByFaceNetResultInfo;
|
|
import com.sunwin.visitorapp.model.OpenDoorByFaceNetResultInfo;
|
|
@@ -67,7 +67,7 @@ public class FaceDetecterView extends RelativeLayout {
|
|
|
|
|
|
|
|
|
|
private CameraHolder cameraHolder;
|
|
private CameraHolder cameraHolder;
|
|
- private boolean isTakePic = false;
|
|
|
|
|
|
+ public boolean needTakePic = false;//是否需要拍照
|
|
|
|
|
|
public FaceDetecterView(Context context) {
|
|
public FaceDetecterView(Context context) {
|
|
super(context);
|
|
super(context);
|
|
@@ -165,15 +165,13 @@ public class FaceDetecterView extends RelativeLayout {
|
|
}
|
|
}
|
|
|
|
|
|
// public void takePic() {
|
|
// public void takePic() {
|
|
-// if (cameraHolder != null && !isTakePic) {
|
|
|
|
-// isTakePic = true;
|
|
|
|
|
|
+// if (cameraHolder != null && needTakePic) {
|
|
|
|
+// needTakePic = false;
|
|
// cameraHolder.mCamera.takePicture(null, null, mJpeg);
|
|
// cameraHolder.mCamera.takePicture(null, null, mJpeg);
|
|
-// } else {
|
|
|
|
-// ToastUtils.showToast("操作太频繁");
|
|
|
|
// }
|
|
// }
|
|
//
|
|
//
|
|
// }
|
|
// }
|
|
-
|
|
|
|
|
|
+//
|
|
// private Camera.PictureCallback mJpeg = new Camera.PictureCallback() {
|
|
// private Camera.PictureCallback mJpeg = new Camera.PictureCallback() {
|
|
// @Override
|
|
// @Override
|
|
// public void onPictureTaken(final byte[] data, Camera camera) {
|
|
// public void onPictureTaken(final byte[] data, Camera camera) {
|
|
@@ -194,8 +192,7 @@ public class FaceDetecterView extends RelativeLayout {
|
|
// }
|
|
// }
|
|
// });
|
|
// });
|
|
// stopCamera();
|
|
// stopCamera();
|
|
-// startCamera();
|
|
|
|
-// isTakePic = false;
|
|
|
|
|
|
+//// startCamera();
|
|
// } catch (Exception e) {
|
|
// } catch (Exception e) {
|
|
// e.printStackTrace();
|
|
// e.printStackTrace();
|
|
// }
|
|
// }
|
|
@@ -214,7 +211,7 @@ public class FaceDetecterView extends RelativeLayout {
|
|
isCanFlush = true;
|
|
isCanFlush = true;
|
|
BaseApplication.getSystemTTS().stopSpeak();
|
|
BaseApplication.getSystemTTS().stopSpeak();
|
|
LogUtil.e(TAG, "接收成功信息");
|
|
LogUtil.e(TAG, "接收成功信息");
|
|
- if (mListener!= null){
|
|
|
|
|
|
+ if (mListener != null) {
|
|
|
|
|
|
mListener.detectedUser(event.getOpenDoorByFaceNetResultInfo());
|
|
mListener.detectedUser(event.getOpenDoorByFaceNetResultInfo());
|
|
}
|
|
}
|
|
@@ -228,6 +225,11 @@ public class FaceDetecterView extends RelativeLayout {
|
|
mListener.detecterFail(event.getDesc());
|
|
mListener.detecterFail(event.getDesc());
|
|
} else if (event.getDesc().equalsIgnoreCase(DescEvent.DESC_FR_FROCUSE_EYE)) {
|
|
} else if (event.getDesc().equalsIgnoreCase(DescEvent.DESC_FR_FROCUSE_EYE)) {
|
|
BaseApplication.getSystemTTS().playText(event.getDesc());
|
|
BaseApplication.getSystemTTS().playText(event.getDesc());
|
|
|
|
+ } else if (event.getDesc().equalsIgnoreCase(DescEvent.DESC_TAKE_PIC)) {
|
|
|
|
+ if (needTakePic) {
|
|
|
|
+ needTakePic = false;
|
|
|
|
+ mListener.takePic(event.getCameraPreviewData());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -249,7 +251,7 @@ public class FaceDetecterView extends RelativeLayout {
|
|
|
|
|
|
void detecterFail(String st);
|
|
void detecterFail(String st);
|
|
|
|
|
|
- void takePic(Bitmap bitmap);
|
|
|
|
|
|
+ void takePic(CameraPreviewData data);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|