Screen Size of the camera on the example object detection of tensorflow lite

北战南征 提交于 2020-04-30 07:10:13

问题


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

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.

Thanks you.


回答1:


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);
  }
}

just replace 1280, 720 by what we want.



来源:https://stackoverflow.com/questions/57242648/screen-size-of-the-camera-on-the-example-object-detection-of-tensorflow-lite

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!