tensorflow - tensorflow lite 示例对象检测中相机的屏幕尺寸
问题描述
在 tensorflow lite 示例对象检测中,相机不会占用所有屏幕,而只是占用一部分。
我试图在 CameraActivity、CameraConnectionFragment 和 Size 类中找到一些常量,但没有结果。
所以我只是想要一种将相机放在整个屏幕上的方法,或者只是一个解释。
谢谢。
解决方案
我刚刚找到了解决方案,它在 CameraConnectionFragment 类中: protected static Size chooseOptimalSize(final Size[] options, final int width, final int height) { 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 替换为我们想要的即可。
推荐阅读
- reactjs - 反应:当导航离开已安装的组件时,如果单击浏览器后退按钮再次显示它
- android-management-api - 政策应用程序中的 Android Management API 权限授予未反映在设备上
- c# - ~/ 和 ../ 之间的区别
- javascript - Style AG Grid 的 rowGroup
- javascript - 在不同范围内执行函数:Javascript
- excel - Excel 函数 - 如果在 B 列中找到来自 A 列的字符串,则
- android - Android Kotlin - 用于 RecyclerView 的 setOnTouchListener 和所有项目子视图/里面的所有内容
- java - 如何将 JS 函数中的 HTML 输入 Thymeleaf th:text?
- gitlab-ci - 仅当 GitLab 中手动触发的作业失败时才运行脚本
- wordpress - WP全部导入:导入前如何删除