【问题标题】:Screen Size of the camera on the example object detection of tensorflow litetensorflow lite 示例对象检测中相机的屏幕尺寸
【发布时间】:2019-07-28 16:04:08
【问题描述】:

在 tensorflow lite 示例对象检测中,摄像头不会占用整个屏幕,而只会占用一部分。

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

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

谢谢。

【问题讨论】:

    标签: tensorflow camera size tensorflow-lite


    【解决方案1】:

    我刚刚找到了解决方案,它在 CameraConnectionFragment 类中: 受保护的静态尺寸选择优化尺寸(最终尺寸 [] 选择,最终 int 宽度,最终 int 高度){ final int minSize = Math.max(Math.min(width, height), MINIMUM_PREVIEW_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 替换为我们想要的即可。

    【讨论】:

    • 如果你放不同的尺寸,图像会失真。
    猜你喜欢
    • 2013-09-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-14
    • 1970-01-01
    相关资源
    最近更新 更多