问题
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