tensorflow lite的示例对象检测中相机的屏幕尺寸 [英] Screen Size of the camera on the example object detection of tensorflow lite

查看:90
本文介绍了tensorflow lite的示例对象检测中相机的屏幕尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在tensorflow lite示例对象检测中,摄像头并不能完全占据整个屏幕,而只是整个屏幕。

On the tensorflow lite example object detection, the camera don't take all the screen but just a part.

我试图在CameraActivity中找到一些常量,CameraConnectionFragment和大小类,但没有结果。

I tried to find some constant in CameraActivity, CameraConnectionFragment and Size classes but no results.

所以我只想一种将照相机放在所有屏幕上的方法,或者只是一种解释。

So I just want a way to put the camera in all the screen or just an explanation.

谢谢。

推荐答案

我刚刚找到了解决方案,它在CameraConnectionFragment类中:
受保护的静态大小choiceOptimalSize(final Size []选择,最终int宽度,最终int高度){
final int minSize = Math.max(Math.min(width,height),MINIMUM_PREVIEW_SIZE);
最终大小期望的大小=新的大小(1280,720);

I just find the solution, it's in the CameraConnectionFragment class : protected static Size chooseOptimalSize(final Size[] choices, final int width, final int height) { final int minSize = Math.max(Math.min(width, height), MINIMUM_PREVIEW_SIZE); final Size desiredSize = new Size(1280, 720);

protected static Size chooseOptimalSize(final Size[] choices, final int width, final int height) {
final int minSize = Math.max(Math.min(width, height), MINIMUM_PREVIEW_SIZE);
final Size desiredSize = new Size(1280, 720);

// Collect the supported resolutions that are at least as big as the preview Surface
boolean exactSizeFound = false;
final List<Size> bigEnough = new ArrayList<Size>();
final List<Size> tooSmall = new ArrayList<Size>();
for (final Size option : choices) {
  if (option.equals(desiredSize)) {
    // Set the size but don't return yet so that remaining sizes will still be logged.
    exactSizeFound = true;
  }

  if (option.getHeight() >= minSize && option.getWidth() >= minSize) {
    bigEnough.add(option);
  } else {
    tooSmall.add(option);
  }
}

只需将1280,720替换为我们想要的。

just replace 1280, 720 by what we want.

这篇关于tensorflow lite的示例对象检测中相机的屏幕尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆