mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 22:44:02 +08:00
simple mean for decode
This commit is contained in:
parent
181de06445
commit
6f82c0d662
@ -247,9 +247,15 @@ static int decode(Sampler &sa, code &cc)
|
||||
{
|
||||
uint8 binary[8] = {0,0,0,0,0,0,0,0};
|
||||
uint8 b = 0;
|
||||
int i, sum;
|
||||
|
||||
for (int i = 0; i < 64; i++) {
|
||||
b = (b << 1) + (sa.getpixel(pickup[i].x, pickup[i].y) <= 128);
|
||||
sum = 0;
|
||||
|
||||
for (i = 0; i < 64; i++)
|
||||
sum += sa.getpixel(1 + (i & 7), 1 + (i >> 3));
|
||||
uint8 mean = sum / 64;
|
||||
for (i = 0; i < 64; i++) {
|
||||
b = (b << 1) + (sa.getpixel(pickup[i].x, pickup[i].y) <= mean);
|
||||
if ((i & 7) == 7) {
|
||||
binary[i >> 3] = b;
|
||||
b = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user