Skip to content

Commit af92097

Browse files
author
Colin Leroy-Mira
committed
Fix greyscale computation and inverted coords
1 parent 0ef9306 commit af92097

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

digital_image_processing/dithering/burkes.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,18 @@ def get_greyscale(cls, blue: int, green: int, red: int) -> float:
4141
>>> Burkes.get_greyscale(3, 4, 5)
4242
3.753
4343
"""
44-
return 0.114 * blue + 0.587 * green + 0.2126 * red
44+
return 0.114 * blue + 0.587 * green + 0.299 * red
4545

4646
def process(self) -> None:
4747
for y in range(self.height):
4848
for x in range(self.width):
4949
greyscale = int(self.get_greyscale(*self.input_img[y][x]))
5050
if self.threshold > greyscale + self.error_table[y][x]:
5151
self.output_img[y][x] = (0, 0, 0)
52-
current_error = greyscale + self.error_table[x][y]
52+
current_error = greyscale + self.error_table[y][x]
5353
else:
5454
self.output_img[y][x] = (255, 255, 255)
55-
current_error = greyscale + self.error_table[x][y] - 255
55+
current_error = greyscale + self.error_table[y][x] - 255
5656
"""
5757
Burkes error propagation (`*` is current pixel):
5858

0 commit comments

Comments
 (0)