ARCore:获取相机的分辨率(ARCore : Get Camera's resolution)
有没有办法获得相机的分辨率? (除非从头开始使用Android)我没有在session.setDisplayGeometry()上的setter上找到任何getter,这并不是我所期望的。
我的目标是知道相机的图片比率,以便在我的显示器上将其裁剪,因为屏幕和相机不使用相同的尺寸。
谢谢。
Is there any way to get camera's resolution ? (unless using Android from scratch) I did not found any getter, on a setter on session.setDisplayGeometry() that is not really what I expect.
My goal is to know the camera's picture ratio to cropp it on my display since the screen and the camera do not use the same size.
Thanks.
原文:https://stackoverflow.com/questions/46667214
更新时间:2020-01-18 20:37
最满意答案
在开发人员预览中,无法通过ARCore API访问摄像头的分辨率。 我在一个单独的问题的评论中询问了解决方案,看起来开发人员预览中的相机分辨率将始终为1920x1080 。
There isn't a way to access the camera's resolution through the ARCore API in the developer preview. I asked about the resolution in comments of a separate question and it looks like the camera resolution in the developer preview will always be 1920x1080.
2017-10-10
相关问答
相机意图启动外部相机应用程序,它可以使用您的提示(但可能不是)。 活动/应用程序是非标准的(取决于电话供应商)以及相机软件的具体实施。 您也可以使用相机api(工作示例在此项目中: http : //sourceforge.net/projects/javaocr/ ),它允许您: 查询支持的图像格式和分辨率(您猜对了 - 厂商依赖) 设置预览和标准分辨率和格式(但相机软件可以自由忽略此设置,尽管某些格式和分辨率被宣传为支持,但某些格式和分辨率可能会产生奇怪的例外) 结论:Android设备中的摄
...
那么,花一些时间调试后,我发现有什么不对。 关键是,如果您的预览与其兼容,则只能设置图片大小。 通过兼容,我的意思是它们的分辨率的宽高比(宽高比)相同。 示例: 宽屏幕预览分辨率仅支持宽屏幕图片分辨率。 如果您对预览进行了错误的分辨率(使用普通屏幕图片进行宽屏幕预览),则图片无法正确设置。 我创建了一个supportedPreviewSize vs supportedPictureSize的示例 preview 800 x 600
2048 x 1536 [ ok ]
1600 x
...
如果您意图启动相机应用程序,则视您的应用程序而定。 (有些实现会支持这个,有些则不支持)。 您可以尝试通过相机类设置图像分辨率,但我发现并非所有广告尺寸都支持,有些会被忽略,有些会产生错误 - 相机应用程序在不同设备上的行为会有所不同。 If you start camera application with intent, you are depending on this application good will. (some implementation will support this
...
在许多情况下,QML Camera的行为很奇怪,而且一些依赖关系没有很好地记录(但是)。 无论如何,以下代码适用于我: import QtQuick 2.6
import QtQuick.Window 2.2
import QtQuick.Layouts 1.3
import QtQuick.Controls 1.4
import QtMultimedia 5.6
Window {
visible: true
width: 1280
height: 960
G
...
不幸的是,没有一种方便的方法可以通过opencv API获取特定相机的支持解决方案列表(因为它支持如此多的平台和许多视频捕获后端)。 即使你的代码会遭受这个,阅读videoio.hpp的来源。 但大多数数字视频设备都支持标准分辨率,您只需从中选择即可。 获得支持格式实际列表的另一种方式是使用第三方库,因为实例Qt通过几个调用解决了这个任务。 Unfortunately there is no convenient way to get supported resolutions list for
...
我不确切知道,但我认为这可以帮到你。 在启动相机之前必须执行以下步骤。 如果要设置视频分辨率,则需要设置预览尺寸,否则需要使用相机参数在相机中设置图像尺寸。 如果不支持给定分辨率,将设置最近的分辨率。 首先得到你的相机。 Camera mCamera = Camera.open();
获取相机参数并在相机参数中设置预览大小。 Camera.Parameters parameters = mCamera.getParameters();
parameters.setPreviewSize(
...
在开发人员预览中,无法通过ARCore API访问摄像头的分辨率。 我在一个单独的问题的评论中询问了解决方案,看起来开发人员预览中的相机分辨率将始终为1920x1080 。 There isn't a way to access the camera's resolution through the ARCore API in the developer preview. I asked about the resolution in comments of a separate question
...
您调整了width和height参数,从而提供无效(不支持)图片大小。 param.SetPictureSize(sizePicture.Width, sizePicture.Height);
void setPictureSize(int width,int height) re: https : //developer.android.com/reference/android/hardware/Camera.Parameters.html You have the width and he
...
您可以使用compressionQuality值压缩图像, -(void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info
{
//Imagedata = UIImageJPEGRepresentation(, );
Image
...
在1.6 sdk中,无法获得支持相机预览的尺寸。 有。 您可以在解析preview-size-values相机参数时获取它们。 String supportedSizesString = parameters.get("preview-size-values");
List supportedSizes = new ArrayList();
if (supportedSizesString != null && supportedSizesString.length() >
...