mirror of
https://github.com/zxing/zxing.git
synced 2025-01-12 19:57:27 -08:00
Issue 494 round luminance values rather than truncate
git-svn-id: https://zxing.googlecode.com/svn/trunk@1558 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
e3bd36499c
commit
4836a3e28c
|
@ -29,10 +29,10 @@ public final class QRCodeBlackBox4TestCase extends AbstractBlackBoxTestCase {
|
|||
|
||||
public QRCodeBlackBox4TestCase() {
|
||||
super("test/data/blackbox/qrcode-4", new MultiFormatReader(), BarcodeFormat.QR_CODE);
|
||||
addTest(35, 35, 0.0f);
|
||||
addTest(36, 36, 0.0f);
|
||||
addTest(36, 36, 90.0f);
|
||||
addTest(34, 34, 180.0f);
|
||||
addTest(34, 34, 270.0f);
|
||||
addTest(35, 35, 180.0f);
|
||||
addTest(35, 35, 270.0f);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -95,7 +95,8 @@ public final class BufferedImageLuminanceSource extends LuminanceSource {
|
|||
int pixel = rgb[offset + x];
|
||||
int luminance = (306 * ((pixel >> 16) & 0xFF) +
|
||||
601 * ((pixel >> 8) & 0xFF) +
|
||||
117 * (pixel & 0xFF)) >> 10;
|
||||
117 * (pixel & 0xFF) +
|
||||
(0x200)) >> 10; // 0x200 = 1<<9, half an lsb of the result to force rounding
|
||||
matrix[offset + x] = (byte) luminance;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue