难道Android的CameraInfo.orientation正确记录?不正确实施?不正确、正确、Android、CameraInfo

2023-09-05 05:50:30 作者:终相守

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

然而,文件似乎与如何我的四个设备的运行不一致,而且,我有一个第五设备的消息对于此得体固定值的变化。

在特定的文件说:

  

的值是角度,相机图像需要被旋转   顺时针所以它正确地显示在其自然在显示器上   方向。 ...例如,假设一个设备具有自然高大   屏幕。背置摄像头传感器安装在的景观。你是   看屏幕。如果照相机传感器的顶侧对准   与屏幕的中自然取向的右边缘,则该值   应该是90。如果一个前置相机传感器的顶侧是   与屏幕的右对齐,该值应为270

但在规定的例子,它是顺时针旋转90度相对于自然竖直方位,而不是周围的其他方式的摄像机图像。即,图像,其顶部与该装置的右侧对齐,需要270度顺时针旋转,以便与装置的顶侧。

至少,我的四个设备报告90这个值,所有的行为,如果相机的顶部右侧的设备时,在自然的方向举行。即,图像必须转动270度顺时针,不是90,以匹配自然取向。这个例子似乎是正确的;第一行不。

This例如code似乎在支持我的结论,因为它只有给出正确的结果,当取向PTED如上除$ P $。

奇怪的是,我有记录从一个用户的设备,显示其报告这个值在90倍,0证据在其他时间!这应该是相机是如何固定在设备的物理特性,对吧?

在任何人都可以确认文件的第一行,其实是错误的,这个例子是正确的? 有没有人看到 CameraInfo.orientation 的变化值?是否有证据的文档,这是合法的行为,或者是有可能在设备中的错误? 在任何其他相关意见,经验,陷阱我还没有碰上了吗? 解决方案   

1)任何人都可以确认该文件的第一行实际上是在   错了,这个例子是正确的?

Camera 2 Android 的文字 0

您已经彻底在你的答案,感谢跟进的解释!

  

2)有没有人观察CameraInfo.orientation的变化值?是否有证据的文档,这是合法的行为,或者是它可能是   在设备的错误?

虽然我可以很容易想象这是原则上的错误,它仍然是一个pretty的严厉的影响的各种成像相关的应用程序,由于通过EXIF嵌入照片中,例如产生的信息(其它< A HREF =htt​​p://stackoverflow.com/a/8864367> EXIF​​相关的错误一边了一会儿)。

因此​​,我认为这更可能是那些成千上万的Andr​​oid设备在那里的一个的实际特点,即有一个选项,以身体旋转镜头相机。虽然我不知道的基于Android的指目前,过去有这样的手机可用,如在 LG VX7000 (〜2004年)或三星SCH-A930(〜2006)(见例如, 旋转摄像头镜头的within手动),所以我不会感到惊讶,如果这样的事情会出现在Android领域也是如此。

顺便说一句,还有一个没有答案的问题的为什么我的图片上下或前后颠倒。的内部Customer问题与放大器;关于答案的三星SCH-A930 后者:

  

最近我的图片已经上下或前后颠倒。为什么是这样   发生,我怎么能解决这个问题。

这实际上可能是在其他方式运作旋转调节硬件/固件错误;)

所以在最后,我想可能是最好的实际prepare为定向能确实改变,直到你有更明确的证据,这是一个有错误的设备。

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.

In particular, the documentation says:

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.

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.

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.

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?

Can anyone confirm that the first line of the documentation is in fact wrong, and the example is right? 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? Any other related comments, experiences, gotchas I have not run into yet?

解决方案

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) 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?

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).

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.

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.