-
Notifications
You must be signed in to change notification settings - Fork 13
ДмитриЙ Мартынов #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
… расчете компонентов цветов и ошибка из-за которой картинка не до конца обрабатывалась
test.py.txt
Outdated
|
|
||
| def get_pixel_color(self, arr, i, j): | ||
| color_sum = 0 | ||
| for n in range(i, i + self.step): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
У вас у объекта класса pixelArtGenerator нет поля step
| res = Image.fromarray(arr) | ||
| res.save('res.jpg') No newline at end of file | ||
|
|
||
| class pixelArtGenerator(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
По PEP8 имя класса начинается с заглавной буквы
| a1 = len(arr[1]) | ||
| for i in range(0, a, self.step): | ||
| for j in range(0, a1, self.step): | ||
| color_sum = self.get_pixel_color(arr, i, j) // (10 * self.shag) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pixelArtGenerator.get_pixel_color() у вас считает сумму всех цвета всех пикселей, а потом вы должны были поделить на 3 и еще на квадрат размера блока.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В последнем комите вы делите на (10 * self.shag) внутри функции, а потом еще раз здесь
| m3 = arr[n][m][2] | ||
| color_sum += int(m1) + int(m2) + int(n3) | ||
| return color_sum | ||
| def get_pixel_color(self, img_array, i, j): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Делим на квадрат размера блока
|
Изменения надо было делать в файле filter.py |
| arr = np.array(img) | ||
| a = len(arr) | ||
| a1 = len(arr[1]) | ||
| for i in range(0, a, self.step): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Поля step у вас нет
|
По итогу ваш код не работает |
|
3 |
No description provided.