gpt4 book ai didi

android - 相机API的理解

转载 作者:行者123 更新时间:2023-11-29 19:07:19 25 4
gpt4 key购买 nike

虽然 Camera API 已被弃用,但它比 Camera2 更容易上手。但是文档好像不太好理解(以我的阅读能力)。我已经搜索了很多试图弄清楚。但是还有很多问题。

1.What is camera's orientation? Is there any definition that I miss? There're 4 dimensions(left, top, right, bottom) of camera. When we say orientation, which one is used and what is the relative object?

2.Why it's different between camera's orientation and device's?

3.Could you please tell me how to understand the algorithm given in the document of Camera.setDisplayOrientation() and Camera.parameters.setRotation()? There're sample code given by document for these two methods. These two algorithm both use sum and difference of orientation/rotation. I may use it directly in my project. But what does that mean exactly?

Besides, taking back-facing camera as example, the former uses (info.orientation - degrees + 360) % 360, while the latter uses (info.orientation + orientation) % 360. Confusing:/

如果您能回答以上任何问题或分享您的一些想法和经验,我们将不胜感激。

最佳答案

1.这是摄像头在您设备中的方向

2.设备方向是您设备的当前方向/旋转(横向/纵向)

3. Camera.setDisplayOrientation()

影响预览

Camera.parameters.setRotation()

影响结果图片(jpeg等)


文档:

Camera.setDisplayOrientation()

Set the clockwise rotation of preview display in degrees. This affects the preview frames and the picture displayed after snapshot. This method is useful for portrait mode applications. Note that preview display of front-facing cameras is flipped horizontally before the rotation, that is, the image is reflected along the central vertical axis of the camera sensor. So the users can see themselves as looking into a mirror.

Camera.parameters.setRotation()

Sets the clockwise rotation angle in degrees relative to the orientation of the camera. This affects the pictures returned from JPEG Camera.PictureCallback. The camera driver may set orientation in the EXIF header without rotating the picture. Or the driver may rotate the picture and the EXIF thumbnail. If the Jpeg picture is rotated, the orientation in the EXIF header will be missing or 1 (row #0 is top and column #0 is left side).

关于android - 相机API的理解,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46701056/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com