QR code scan Android Zxing image stretching Solution
Zxing is a QR code scanning project provided by google.
By default, the image is stretched after the screen is converted to a portrait.
The solution is as follows:
Zxing modifies
Void initFromCameraParameters (Camera camera) Method
Add 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; }
After
cameraResolution = getCameraResolution(parameters, screenResolution);
Change screenResolution to screenResolutionForCamera in
As follows:
cameraResolution = getCameraResolution(parameters, screenResolutionForCamera);
: Http://download.csdn.net/detail/aaawqqq/7281577