if (accept(image, n, initial, threshold) && output.pixels[n.y][n.x] != 1) { while (w > 0 && accept(image, new Pixel(w - 1, n.y), initial, threshold)) w--; while (e < image.getWidth() - 1 && accept(image, new Pixel(e + 1, n.y), initial, threshold)) e++; if (north >= 0 && accept(image, new Pixel(i, north), initial, threshold) && output.pixels[north][i] != 1) queue.add(new Pixel(i, north)); if (south < image.getHeight() && accept(image, new Pixel(i, south), initial, threshold) && output.pixels[south][i] != 1) queue.add(new Pixel(i, south));
if (accept(image, n, initial, threshold) && output.pixels[n.y][n.x] != 1) { while (w > 0 && accept(image, new Pixel(w - 1, n.y), initial, threshold)) w--; while (e < image.getWidth() - 1 && accept(image, new Pixel(e + 1, n.y), initial, threshold)) e++; if (north >= 0 && accept(image, new Pixel(i, north), initial, threshold) && output.pixels[north][i] != 1) queue.add(new Pixel(i, north)); if (south < image.getHeight() && accept(image, new Pixel(i, south), initial, threshold) && output.pixels[south][i] != 1) queue.add(new Pixel(i, south));