我正在尝试将前置摄像头用于zxing
Android 平板电脑上的条码扫描仪——为了使其工作,我做了以下更改:
1) 姜饼OpenCameraInterface.java
// if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_BACK) {
if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
2)CameraManager.java
// return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top,
// rect.width(), rect.height(), false); //changed false to true below
return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top,
rect.width(), rect.height(), true);
3)CameraConfigurationManager.java:
camera.setDisplayOrientation(180); // added to rotate the image by 180 degrees as it ws already flipped once had changed to frontcamera
4)也在AndroidManifest.xml中:
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.front" android:required="false"/>
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
<uses-feature android:name="android.hardware.camera.flash" android:required="false"/>
<uses-feature android:name="android.hardware.screen.landscape"/>
<uses-feature android:name="android.hardware.wifi" android:required="false"/>
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
它扫描得很好,但是当它扫描并显示最后几秒钟的预览图像时,它会显示一个倒置的图像。这是快照的链接http://i.imgur.com/gIvXy52.png
因此,如果有人可以提供帮助,我有以下问题:
1)如何将最终预览倒置图像改为正常
2)有什么办法可以删除显示捕获图像最后几秒的部分。