threshold() uses now the row_average member of struct quirc.
This commit is contained in:
parent
21f6863577
commit
90371f36a0
1 changed files with 4 additions and 6 deletions
|
@ -196,9 +196,7 @@ static void threshold(struct quirc *q)
|
||||||
threshold_s = THRESHOLD_S_MIN;
|
threshold_s = THRESHOLD_S_MIN;
|
||||||
|
|
||||||
for (y = 0; y < q->h; y++) {
|
for (y = 0; y < q->h; y++) {
|
||||||
int row_average[q->w];
|
memset(q->row_average, 0, q->w * sizeof(int));
|
||||||
|
|
||||||
memset(row_average, 0, sizeof(row_average));
|
|
||||||
|
|
||||||
for (x = 0; x < q->w; x++) {
|
for (x = 0; x < q->w; x++) {
|
||||||
int w, u;
|
int w, u;
|
||||||
|
@ -216,12 +214,12 @@ static void threshold(struct quirc *q)
|
||||||
avg_u = (avg_u * (threshold_s - 1)) /
|
avg_u = (avg_u * (threshold_s - 1)) /
|
||||||
threshold_s + row[u];
|
threshold_s + row[u];
|
||||||
|
|
||||||
row_average[w] += avg_w;
|
q->row_average[w] += avg_w;
|
||||||
row_average[u] += avg_u;
|
q->row_average[u] += avg_u;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (x = 0; x < q->w; x++) {
|
for (x = 0; x < q->w; x++) {
|
||||||
if (row[x] < row_average[x] *
|
if (row[x] < q->row_average[x] *
|
||||||
(100 - THRESHOLD_T) / (200 * threshold_s))
|
(100 - THRESHOLD_T) / (200 * threshold_s))
|
||||||
row[x] = QUIRC_PIXEL_BLACK;
|
row[x] = QUIRC_PIXEL_BLACK;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue