Android的前置摄像头的prevent翻转 [英] Prevent Flipping of the Android Front Facing Camera

查看:841
本文介绍了Android的前置摄像头的prevent翻转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图访​​问Android的前置摄像头的新进料。默认情况下,前置摄像头的preVIEW的水平翻转,使用户可以看到自己仿佛在寻找到了镜子 - 这是伟大的,但不是我所需要的。什么是让新进料的最佳方法是什么?有没有一些方法来禁用自动翻转,或者我应该试图甩掉它在code自己(如果有的话,什么是这样做的最佳方式)?为了清楚起见,我的应用程序需要显示的前置摄像头的实时反馈,而不必让翻转像一面镜子。

I'm attempting to access the raw feed of android's front facing camera. By default, the front facing camera's preview is flipped horizontally so users can see themselves as if looking into a mirror - that's great, but not what I need. What's the best way to get the raw feed? Is there some way to disable the automatic flipping, or should I attempt to flip it in code myself (and if so, what's the best way to do so)? For clarity, my application needs to display a real-time feed of the front facing camera without it being flipped like a mirror.

推荐答案

如果你想使用一个前置摄像头的吧code扫描您可以使用TextureView和应用转换矩阵它。当结构是更新可以读出的图像数据,并使用该

If you want to use a front-facing camera for barcode scanning you can use TextureView and apply a transformation matrix to it. When the texture is updated you can read the image data and use that.

请参阅 https://github.com/hadders/ca​​mera-reverse

具体从MainActivity.java

Specifically from MainActivity.java

mCamera.setDisplayOrientation(90);
Matrix matrix = new Matrix();
matrix.setScale(-1, 1);
matrix.postTranslate(width, 0);
mTextureView.setTransform(matrix);

这篇关于Android的前置摄像头的prevent翻转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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