279 |
|
neigh[i][0] = i; /* identity is terminator */ |
280 |
|
} |
281 |
|
/* make neighbor lists */ |
282 |
< |
for (r = 0; r < NRED-1; r++) |
283 |
< |
for (g = 0; g < NGRN-1; g++) |
284 |
< |
for (b = 0; b < NBLU-1; b++) { |
285 |
< |
if (histo[r][g][b] != histo[r+1][g][b]) |
282 |
> |
for (r = 0; r < NRED; r++) |
283 |
> |
for (g = 0; g < NGRN; g++) |
284 |
> |
for (b = 0; b < NBLU; b++) { |
285 |
> |
if (r < NRED-1 && histo[r][g][b] != histo[r+1][g][b]) |
286 |
|
addneigh(neigh, histo[r][g][b], histo[r+1][g][b]); |
287 |
< |
if (histo[r][g][b] != histo[r][g+1][b]) |
287 |
> |
if (g < NGRN-1 && histo[r][g][b] != histo[r][g+1][b]) |
288 |
|
addneigh(neigh, histo[r][g][b], histo[r][g+1][b]); |
289 |
< |
if (histo[r][g][b] != histo[r][g][b+1]) |
289 |
> |
if (b < NBLU-1 && histo[r][g][b] != histo[r][g][b+1]) |
290 |
|
addneigh(neigh, histo[r][g][b], histo[r][g][b+1]); |
291 |
|
} |
292 |
|
/* assign closest values */ |