Skip to content

Commit

Permalink
解决条形码与预览框的水平倾角超过30%识别不了,感谢群友 alert 的贡献
Browse files Browse the repository at this point in the history
  • Loading branch information
TommyLemon committed Nov 10, 2018
1 parent 1605649 commit 4817e15
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

package com.zxing.decoding;
import java.util.Hashtable;

import android.os.Bundle;
import android.os.Handler;
Expand All @@ -34,6 +33,8 @@
import com.zxing.camera.CameraManager;
import com.zxing.camera.PlanarYUVLuminanceSource;

import java.util.Hashtable;

final class DecodeHandler extends Handler {

private static final String TAG = DecodeHandler.class.getSimpleName();
Expand Down Expand Up @@ -85,6 +86,13 @@ private void decode(byte[] data, int width, int height) {
rawResult = multiFormatReader.decodeWithState(bitmap);
} catch (ReaderException re) {
// continue
try { //解决条形码与预览框的水平倾角超过30%识别不了,感谢群友 alert(3339238074) 的贡献
source = CameraManager.get().buildLuminanceSource(data, height, width);
bitmap = new BinaryBitmap(new HybridBinarizer(source));
rawResult = multiFormatReader.decodeWithState(bitmap);
} catch (Exception e) {
multiFormatReader.reset();
}
} finally {
multiFormatReader.reset();
}
Expand Down

0 comments on commit 4817e15

Please sign in to comment.