人脸识别支付流程
This commit is contained in:
@@ -88,8 +88,10 @@ public class ConfigUtil {
|
||||
* 默认相机分辨率
|
||||
*/
|
||||
// private static final String DEFAULT_PREVIEW_SIZE = "1280x720";
|
||||
private static final String DEFAULT_PREVIEW_SIZE = "600x400";
|
||||
// private static final String DEFAULT_PREVIEW_SIZE = "400x640";
|
||||
// private static final String DEFAULT_PREVIEW_SIZE = "608x456";
|
||||
private static final String DEFAULT_PREVIEW_SIZE = "1024x768";
|
||||
// private static final String DEFAULT_PREVIEW_SIZE = "800x600";
|
||||
// private static final String DEFAULT_PREVIEW_SIZE = "640x480";
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.sw.plate.utils.arcface.camera;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.ImageFormat;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.SurfaceTexture;
|
||||
@@ -42,8 +43,10 @@ public class DualCameraHelper implements Camera.PreviewCallback {
|
||||
|
||||
private Integer specificCameraId = null;
|
||||
private CameraListener cameraListener;
|
||||
private static final int MIN_PREVIEW_WIDTH = 720;
|
||||
private static final int MIN_PREVIEW_HEIGHT = 720;
|
||||
// private static final int MIN_PREVIEW_WIDTH = 720;
|
||||
// private static final int MIN_PREVIEW_HEIGHT = 720;
|
||||
private static final int MIN_PREVIEW_WIDTH = 800;
|
||||
private static final int MIN_PREVIEW_HEIGHT = 600;
|
||||
|
||||
private DualCameraHelper(Builder builder) {
|
||||
previewDisplayView = builder.previewDisplayView;
|
||||
@@ -60,6 +63,16 @@ public class DualCameraHelper implements Camera.PreviewCallback {
|
||||
}
|
||||
}
|
||||
|
||||
public interface SurfaceFrameCallback {
|
||||
void onFrameCallback(Bitmap frame);
|
||||
}
|
||||
|
||||
private SurfaceFrameCallback surfaceFrameCallback;
|
||||
|
||||
public void setSurfaceFrameCallback(SurfaceFrameCallback callback) {
|
||||
this.surfaceFrameCallback = callback;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
if (previewDisplayView instanceof TextureView) {
|
||||
((TextureView) this.previewDisplayView).setSurfaceTextureListener(textureListener);
|
||||
@@ -126,6 +139,12 @@ public class DualCameraHelper implements Camera.PreviewCallback {
|
||||
return;
|
||||
}
|
||||
List<Camera.Size> supportedPreviewSize = getCommonSupportedPreviewSize();
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (Camera.Size size : supportedPreviewSize) {
|
||||
stringBuilder.append("width=").append(size.width).append(",")
|
||||
.append("height=").append(size.height).append(",");
|
||||
}
|
||||
Log.d(TAG, "start: "+stringBuilder);
|
||||
//相机数量为2则打开1,1则打开0,相机ID 1为前置,0为后置
|
||||
mCameraId = Camera.getNumberOfCameras() - 1;
|
||||
//若指定了相机ID且该相机存在,则打开指定的相机
|
||||
@@ -371,7 +390,12 @@ public class DualCameraHelper implements Camera.PreviewCallback {
|
||||
|
||||
@Override
|
||||
public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {
|
||||
|
||||
if (surfaceFrameCallback!=null) {
|
||||
if (previewDisplayView instanceof TextureView) {
|
||||
Bitmap frame = ((TextureView) previewDisplayView).getBitmap();
|
||||
surfaceFrameCallback.onFrameCallback(frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
private SurfaceHolder.Callback surfaceCallback = new SurfaceHolder.Callback() {
|
||||
|
||||
Reference in New Issue
Block a user