Android相机结果图像应在捕获后旋转? [英] Android camera resulted image should be rotated after the capture?
问题描述
我正在编写一个使用相机的 Android 应用程序.我将相机显示方向设置为 90,我的活动是纵向的:
I'm writing an Android application that uses the camera. I'm setting camera display orientation to 90, my activity is in a portrait orientation:
camera.setDisplayOrientation(90);
我得到了一个方向良好的预览图片,但生成的图片被旋转到 -90 度(逆时针)并且
I'm getting a well oriented preview picture, but the resulting image is rotated to -90 degrees (counter clockwise) and
exif.getAttribute(ExifInterface.TAG_ORIENTATION)
返回 ORIENTATION_NORMAL
这是预期的行为吗?我应该在捕获后旋转结果图像吗?
returns ORIENTATION_NORMAL
Is it expected behavior? Should I rotate resulted image after the capture?
设备 - Nexus S,API - 10
Device - Nexus S, API - 10
推荐答案
问题是相机方向是一场彻底的灾难(就像捕捉图像一样),因为 OEM 不遵守标准.HTC 手机以一种方式做事,三星手机以不同的方式做事,Nexus 系列似乎无论哪个供应商都坚持,基于 CM7 的 ROM 我认为无论哪种硬件都遵循标准,但你明白了.您必须根据手机/ROM确定要做什么.请参阅此处的讨论:Android 相机无法解释的旋转在某些设备上捕获(不在 EXIF 中)
Problem is the camera orientation is a complete disaster (as is capturing an image) because OEMs do not adhere to the standard. HTC phones do things one way, Samsung phones do it a different way, the Nexus line seems to adhere no matter which vendor, CM7 based ROMs I think follow the standard no matter which hardware, but you get the idea. You sort of have to determine what to do based on the phone/ROM. See discussion here: Android camera unexplainable rotation on capture for some devices (not in EXIF)
这篇关于Android相机结果图像应在捕获后旋转?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!