ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

Android 1.6相机旋转?

2019-08-27 16:11:26  阅读:136  来源: 互联网

标签:android rotation camera


我在android dev论坛上发布了这个,但是想在这里联系.

我们的应用程序中的一项活动是拍照.图片预览在1.5&屏幕上显示正确的屏幕显示方式. 1.6,但保存时,它保存jpg 90旋转.

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

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中,您需要调用parameters.set(“rotation”,degree)以在调用takePicture()之前告知驱动程序有关旋转的信息.在2.0中,有一个新的API setRotation(见下文).请注意,有些设备会为您旋转整个图片,有些设备只会在EXIF标题中设置方向.

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 2048×1536 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,rotation,camera
来源: https://codeday.me/bug/20190827/1742478.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有