gpt4 book ai didi

Android 1.6 相机旋转?

转载 作者:太空宇宙 更新时间:2023-11-03 12:43:32 25 4
gpt4 key购买 nike

我在 android 开发论坛上发布了这个,但想联系这里。

我们应用程序中的一项 Activity 是拍照。图片预览在1.5&1.6屏幕显示正确,但保存时保存的是90度旋转的jpg。

显示时我可以实时旋转它,我想我可以在保存后重新保存它。我的问题是我想在拍照时正确保存它。

My app while compiled in 1.5 works fine. I had some memory issues w/ 1.6 due to image size, which was strange b/c the image size increased when taking photos by taking a picture w/ surfaceholder/imagecapture callback. I seem to have fixed re-displaying those images by resizing them using a bitmapfactory matrix. But my camera is now rotating everything 90 degrees. It appears that my Override of surfaceChanged does nothing, which is where I was setting rotation at 90 (I can't remember why, it was 10 months ago!). I have tried at rotating the camera parameters paramters at 90 degrees, 0 degrees. It does not seem to do anything... any thoughts?

最佳答案

相机驱动程序不知道设备的方向。在1.5和1.6中,在调用takePicture()之前需要先调用parameters.set("rotation", degree)告诉驱动旋转。在 2.0 中,有一个新的 API setRotation(见下文)。请注意,有些设备会为您旋转整张图片,而有些只是在 EXIF header 中设置方向。

http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setRotation(int)

Sets the orientation of the device in degrees. For example, suppose the natural position of the device is landscape. If the user takes a picture in landscape mode in 2048x1536 resolution, the rotation should be set to 0. If the user rotates the phone 90 degrees clockwise, the rotation should be set to 90. Applications can use OrientationEventListener to set this parameter. 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).
Parameters
rotation The orientation of the device in degrees. Rotation can only be 0, 90, 180 or 270

关于Android 1.6 相机旋转?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1607477/

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