fix a little error

RGB to gray, the weight of R is 0.299, not 0.229.  The comment have a little error. And why add 0x200 ? It may be a error.  306/1024 = 0.2988.  601/1024=0.5869 and 117/1027 = 0.1143.
This commit is contained in:
wood 2015-10-01 12:30:15 +08:00
parent 6d61977c2e
commit b5e9cffeba

View file

@ -70,12 +70,12 @@ public final class BufferedImageLuminanceSource extends LuminanceSource {
pixel = 0xFFFFFFFF; // = white
}
// .229R + 0.587G + 0.114B (YUV/YIQ for PAL and NTSC)
// .299R + 0.587G + 0.114B (YUV/YIQ for PAL and NTSC)
buffer[x] =
(306 * ((pixel >> 16) & 0xFF) +
601 * ((pixel >> 8) & 0xFF) +
117 * (pixel & 0xFF) +
0x200) >> 10;
117 * (pixel & 0xFF)
) >> 10;
}
raster.setPixels(left, y, width, 1, buffer);
}