android front and back camera captured picture orientation issue, rotated in a wrong way

后端 未结 5 1369
一整个雨季
一整个雨季 2021-02-05 10:12

I have a camera app in portrait mode which takes pictures from both front and back end cameras.The issue is like the captured images are rotated in a wrong way...

For pr

5条回答
  •  感动是毒
    2021-02-05 10:58

    the selected answer just gives the the possible rotation that may have been saved in EXIF header. in several cases camera doesn't set "ExifInterface.TAG_ORIENTATION" attribute in EXIFHeader so it will be 0(ExifInterface.ORIENTATION_UNDEFINED). and event if it is set it will be true in only one case/orientation when the picture is taken. you have to manually set rotation in camera parameters using setRotation() method. the documentation of setRotation() is very clear and also explains how to calculate rotation with consideration of device rotation and camera sensor orientation(usually landscape).

    so check out setRotation() method . thats what you need to change.

提交回复
热议问题