我怎样才能找到意图MediaStore.ACTION_IM​​AGE_CAPTURE拍摄的照片的方向? [英] How can i find the orientation of a picture taken with Intent MediaStore.ACTION_IMAGE_CAPTURE?

查看:355
本文介绍了我怎样才能找到意图MediaStore.ACTION_IM​​AGE_CAPTURE拍摄的照片的方向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我采取与机器人相机应用的图片,检测手机的方向,并相应地保存照片。所以,如果我把建筑物的照片,屋顶将在上行路上,我是否拿着手机在横向位置或肖像。

When I take a picture with Androids camera app, it detects the phone's orientation and saves the pic accordingly. So if i take a picture of a building, the roof will be on the topside, whether I hold the phone in landscape position or portrait.

然而,当我使用

意图imageCaptureIntent =新的意图(MediaStore.ACTION_IM​​AGE_CAPTURE);

Intent imageCaptureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

要获得照片时,相机应用程序不应对方向。 如果我拿着手机垂直(纵向),将得到的峰将被旋转,与所述建筑物的屋顶,以在屏幕的左侧。

to get a picture, the camera app doesn't react to orientation. If i hold the phone vertically (portrait), the resulting pic will be rotated, with said building's roof to the left of the screen.

我如何设置的意图,使相机将定位考虑?

How can I set the intent so that the camera will take orientation into account?

或者,我可以推断出以某种方式在什么方位事先知情同意拍摄,并随后将其旋转自己?

Or can I deduce in some way in what orientation the pic was taken and rotate it myself afterward?

或任何其他建议,将大大AP preciated。

Or any other suggestion will be greatly appreciated.

〜在此先感谢,最诚挚的问候。

~Thanks in advance, best regards.

推荐答案

找到了答案。图像的EXIF具有取向的指标。为以防万一,EXIF可以被视为在Android中是这样的:

Found the answer. The exif of the image has an indicator of the orientation. Just in case, exif can be viewed in Android like this:

ExifInterface exif = new ExifInterface("filepath");  
exif.getAttribute(ExifInterface.TAG_ORIENTATION);

这篇关于我怎样才能找到意图MediaStore.ACTION_IM​​AGE_CAPTURE拍摄的照片的方向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆