0

我正在实施媒体管道手部跟踪

https://google.github.io/mediapipe/solutions/hands

在android中,只有在预览相机数据时才能获得地标,否则无法扣分

如何在不预览相机或图像的情况下访问地标?

4

1 回答 1

0

您可以将预览的可见性设置为 GONE。这样预览就不会显示。

private void startCamera() {
    cameraHelper = new CameraXPreviewHelper();         
    cameraHelper.setOnCameraStartedListener(
            surfaceTexture -> {
                previewFrameTexture = surfaceTexture;
                // Make the display view visible to start showing the preview. This triggers the
                // SurfaceHolder.Callback added to (the holder of) previewDisplayView.

                // comment this *********
                // previewDisplayView.setVisibility(View.VISIBLE);

                onCameraStarted(surfaceTexture);
            });
    cameraHelper.startCamera(this, CAMERA_FACING, /*surfaceTexture=*/ null);
}

“previewFrameTexture”是发送处理的,但它是从surfaceTexture 复制的。请记住,这不会触发回调,因此请手动设置转换器大小。

converter.setSurfaceTextureAndAttachToGLContext(previewFrameTexture,*width of your camera preview size, height of your camera preview size;

有关更多信息,请查看此链接: Mediapipe 示例

于 2021-08-26T21:05:32.073 回答