简体   繁体   English

将Android前置摄像头翻转预览以进行条形码扫描

[英]Flip Android front camera on preview for barcode scanning

I have an application that scan barcode with the Android device cameras. 我有一个使用Android设备相机扫描条形码的应用程序。 I take the example program here: https://github.com/journeyapps/zxing-android-embedded 我在这里使用示例程序: https : //github.com/journeyapps/zxing-android-embedded

Now, I want to scan a barcode with my device front camera. 现在,我想使用设备前置摄像头扫描条形码。 On that sample solution there's a button that allow you to take a barcode by front camera, but the problem is that the Preview image of camera is "flipped", like on a mirror, and so the application can't read the barcode. 在该示例解决方案上,有一个按钮可以让您通过前置摄像头读取条形码,但问题是摄像头的预览图像像镜子上一样“翻转”,因此应用程序无法读取条形码。

Is there a method to overcome this problem and to make sure that the recorded image is displayed correctly? 是否有一种方法可以解决此问题并确保正确显示记录的图像?

This mirroring is hardcoded into the camera service, and can not be disabled. 此镜像已硬编码到相机服务中,无法禁用。

Try applying a transformation matrix to a TextureView. 尝试将转换矩阵应用于TextureView。 As per Prevent flipping of the front facing camera 按照防止前置摄像头翻转

This works for API level >= 14 适用于API级别> = 14

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM