tensorflow - Tensorflow lite 对象检测示例中相机的屏幕尺寸

标签 tensorflow camera size tensorflow-lite

在tensorflow lite示例对象检测中,相机不会拍摄整个屏幕,而只会拍摄一部分。

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

所以我只是想要一种将相机放在整个屏幕中的方法,或者只是一个解释。

谢谢你。

最佳答案

我刚刚找到解决方案,它在 CameraConnectionFragment 类中: protected static Size ChooseOptimalSize(final Size[] Choices, Final int width, Final int height) { 最终 int minSize = Math.max(Math.min(宽度, 高度), MINIMUM_PREVIEW_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 替换为我们想要的即可。

关于tensorflow - Tensorflow lite 对象检测示例中相机的屏幕尺寸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57242648/

相关文章:

image-processing - 射影空间中来自内参的无穷远平面

iOS 8 : Camera: manual EV slider

android - 相机错误 100 详细信息

c++ - PROCESSENTRY32 .dwSize 和 sizeof

python-2.7 - 在 Docker 中使用 Tensorflow 1.4 进行 GAN 训练在没有提示且没有释放通过 SSH 连接连接到 VM 的情况下停止

python - 安装tensorflow-gpu时出现错误: Cannot uninstall 'wrapt' .~=1.14

c# - IronPython:意外 token 'from'

python - CleverHans 的随机森林黑盒

python - 使用 Python Plotly 绘制气泡大小图例

ios - Spritekit SKNode 大小百分比