使用Zxing扫描二维码的时候,图片变形

Zxing 修改 CameraConfigurationManager.java文件的

**void initFromCameraParameters(Camera camera)**方法,

在 **Log.d(TAG, "Screen resolution: " + screenResolution);**这句之后增加

Point screenResolutionForCamera = new Point();  

        screenResolutionForCamera.x = screenResolution.x;  

        screenResolutionForCamera.y = screenResolution.y;  

        // preview size is always something like 480*320, other 320*480  

        if (screenResolution.x < screenResolution.y) {
       

        screenResolutionForCamera.x = screenResolution.y;  

        screenResolutionForCamera.y = screenResolution.x;  

        }  

在把其后的

cameraResolution = getCameraResolution(parameters, screenResolution);  

中的screenResolution改为 screenResolutionForCamera
如下:

cameraResolution = getCameraResolution(parameters, screenResolutionForCamera);  

转载至:https://blog.csdn.net/asdf717/article/details/62044454

你可能感兴趣的:(使用Zxing扫描二维码的时候,图片变形)