Android的,正面和背面摄像头方向,景观 [英] Android, front and back camera Orientation , Landscape
问题描述
在我的相机应用程序,你可以在正面和背面摄像头之间切换。 当我把照片与相机背面的图片是一样的,如preVIEW节目。 但是,当我切换到前置摄像头,画面mirrorrd.I认为这事做的正面和背面的摄像头为横向模式。 我曾尝试在所以几乎每一个给定的答案。
In my camera app, you can switch between the front and back camera. When I take picture with the back camera the picture is the same like the preview shows. But when I switch to the front camera, the picture is mirrorrd.I think it has something to do that front and back camera is in landscape mode. I have tried almost every given answers on SO.
这将真正帮助,如果有人可以点我在正确的方向。
It would really help if someone could point me in the right directions.
推荐答案
我找到了答案,做 mCamera.setDisplayOrientationa(INT度);
并没有帮助。我不得不镜像生成的位图,以获得我想要的结果。我用的阵法为实现这一目标。
I found the answer , doing mCamera.setDisplayOrientationa(int degrees);
did not help. I had to mirror the generated bitmap in order to get the result I wanted. I used the Matrix method to a achieve this .
float[] mirrorY = { -1, 0, 0, 0, 1, 0, 0, 0, 1};
Matrix matrix = new Matrix();
Matrix matrixMirrorY = new Matrix();
matrixMirrorY.setValues(mirrorY);
matrix.postConcat(matrixMirrorY);
image = Bitmap.createBitmap(mBitmap, 0, 0, frame.getWidth(), frame.getHeight(), matrix, true)
这篇关于Android的,正面和背面摄像头方向,景观的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!