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