Skip to content

Conversation

@klubnichniyvolk
Copy link

No description provided.

Dima added 5 commits November 19, 2021 22:51
test.py.txt Outdated

def get_pixel_color(self, arr, i, j):
color_sum = 0
for n in range(i, i + self.step):
Copy link
Owner

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():
Copy link
Owner

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)
Copy link
Owner

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 и еще на квадрат размера блока.

Copy link
Owner

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):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Делим на квадрат размера блока

@railbotan
Copy link
Owner

Изменения надо было делать в файле filter.py

arr = np.array(img)
a = len(arr)
a1 = len(arr[1])
for i in range(0, a, self.step):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Поля step у вас нет

@railbotan
Copy link
Owner

По итогу ваш код не работает

@railbotan
Copy link
Owner

3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants