Android 的 CameraInfo.orientation 是否正确记录?执行不正确? [英] Is Android's CameraInfo.orientation correctly documented? Incorrectly implemented?

查看:10
本文介绍了Android 的 CameraInfo.orientation 是否正确记录?执行不正确?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Android 中,您可以通过检索 CameraInfo 来获得对 Camera 属性的描述.我对方向感兴趣,如 http://developer 中所述.android.com/reference/android/hardware/Camera.CameraInfo.html#orientation

In Android you can get a description of the properties of a Camera by retrieving a CameraInfo. I'm interested in orientation, as described at http://developer.android.com/reference/android/hardware/Camera.CameraInfo.html#orientation

但是,文档似乎与我所有四个设备的行为方式不一致,而且,我有消息称第五个设备的这个看似固定的值发生了变化.

However the documentation seems inconsistent with how all four of my devices behave, and, I have news of a fifth device for which this seemly fixed value changes.

特别是,文档说:

该值是相机图像需要旋转的角度顺时针方向,使其以自然的方式正确显示在显示屏上方向....例如,假设设备具有自然高屏幕.后置摄像头传感器横向安装.你是看着屏幕.如果相机传感器的顶部对齐在屏幕右边缘处于自然方向的情况下,该值应该是 90.如果前置摄像头传感器的顶部是与屏幕右侧对齐,值应为 270.

The value is the angle that the camera image needs to be rotated clockwise so it shows correctly on the display in its natural orientation. ... For example, suppose a device has a naturally tall screen. The back-facing camera sensor is mounted in landscape. You are looking at the screen. If the top side of the camera sensor is aligned with the right edge of the screen in natural orientation, the value should be 90. If the top side of a front-facing camera sensor is aligned with the right of the screen, the value should be 270.

但在上述示例中,相机图像相对于自然高的方向顺时针旋转了 90 度,而不是相反.也就是说,顶部与设备右侧对齐的图像需要顺时针旋转 270 度才能与设备顶部对齐.

But in the stated example, it is the camera image that is rotated 90 degrees clockwise relative to the naturally tall orientation, not the other way around. That is, the image, whose top is aligned with the right hand side of the device, needs 270 degrees clockwise rotation to align with the device's top side.

至少,我的所有四台设备都报告了这个值90",并且当以自然方向握住时,它们都表现得好像相机的顶部是设备的右侧.也就是说,图像必须顺时针旋转 270 度,而不是 90 度,以匹配自然方向.这个例子似乎是正确的;第一行没有.

At least, all four of my devices report "90" for this value, and all act as if the camera's top is the right side of the device when held in natural orientation. That is, the image must be rotated 270 degrees clockwise, not 90, to match the natural orientation. The example seems correct; the first line does not.

这个示例代码似乎支持我的结论是,只有当方向按上述解释时,它才会给出正确的结果.

This example code seems to support my conclusion as it only gives the right result when orientation is interpreted as above.

奇怪的是,我有来自一个用户设备的日志证据,显示它有时会将此值报告为 90,而在其他时候报告为 0!它应该是相机在设备中的安装方式的物理属性,对吧?

Strangely, I have log evidence from one user's device that shows it reporting this value as 90 at times, and 0 at other times! It ought to be a physical property of how the camera is seated in the device, right?

  1. 谁能确认文档的第一行实际上是错误的,而示例是正确的?
  2. 有没有人观察到 CameraInfo.orientation 值的变化?文档中是否有证据表明这是合法行为,还是可能是设备中的错误?
  3. 我还没有遇到任何其他相关的评论、经验、陷阱吗?
  1. Can anyone confirm that the first line of the documentation is in fact wrong, and the example is right?
  2. Has anyone observed a changing value of CameraInfo.orientation? Is there evidence in docs that this is legal behavior, or is it likely a bug in the device?
  3. Any other related comments, experiences, gotchas I have not run into yet?

推荐答案

1) 任何人都可以确认文档的第一行实际上是错了,例子对吗?

1) Can anyone confirm that the first line of the documentation is in fact wrong, and the example is right?

您已经在您的回答中彻底解决了这个问题,感谢您的后续解释!

You have thoroughly addressed this already within your answer, thanks for the follow up explanation!

2) 有没有人观察到 CameraInfo.orientation 值的变化?文档中是否有证据表明这是合法行为,或者可能是设备有问题?

2) Has anyone observed a changing value of CameraInfo.orientation? Is there evidence in docs that this is legal behavior, or is it likely a bug in the device?

虽然原则上我可以很容易地想象这是一个错误,但它仍然是一个非常严重的错误,会影响各种与成像相关的应用程序,因为结果信息通过 EXIF 嵌入到照片中(其他 EXIF 相关的错误暂且不提).

While I can easily imagine this to be a bug in principle, it would still be a pretty severe one affecting all sorts of imaging related apps due to the resulting information being embedded via EXIF in photos for example (other EXIF related bugs aside for a moment).

因此,我认为它更有可能是成千上万的 Android 设备之一的实际功能,即具有物理旋转镜头选项的相机.虽然我目前不知道基于 Android 的手机,但曾经有这样的手机可用,例如LG VX7000 (~2004) 或三星 SCH-a930 (~2006)(参见例如旋转相机镜头 在手册中),所以如果这样的东西也会出现在Android领域,我不会感到惊讶.

Thus, I'd consider it more likely to be an actual feature of one of those thousands of Android devices out there, i.e. a camera with an option to physically rotate the lens. While I'm not aware of an Android based one currently, there used to be such phones available, e.g. the LG VX7000 (~2004) or the Samsung SCH-a930 (~2006) (see e.g. Rotating Camera Lens within the manual), so I'd not be surprised if something like this would appear in the Android sphere as well.

顺便说一句,在 客户问题&三星 SCH-A930 关于后者的答案:

Incidentally, there is an unanswered question Why are my pics upside down or backwards. within Customer Questions & Answers for Samsung SCH-A930 regarding the latter:

最近我的照片被颠倒或倒置.为什么是这样正在发生,我该如何解决.

Lately my pics have been upside down or backwards. Why is this happening and how can I fix it.

这实际上可能是旋转调整硬件/固件中的一个错误;)

This might actually be a bug in the otherwise functioning rotation adjustment hardware/firmware ;)

因此,总而言之,我认为最好为能够改变的方向做好实际准备,直到你有更明确的证据证明这确实是一个有问题的设备.

So in conclusion, I think it might be best to actually prepare for the orientation being able to change until you have more definite evidence for this to be a buggy device indeed.

这篇关于Android 的 CameraInfo.orientation 是否正确记录?执行不正确?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆