Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PIL import Image
- from PIL.PngImagePlugin import PngImageFile
- def get_central_line_of_pixels(img: PngImageFile):
- pixels = []
- for i in range(img.width):
- pixels.append(img.getpixel((i, img.height//2)))
- pixels[i] = round(pixels[i] / 20) * 20
- return pixels
- def main():
- img: PngImageFile = Image.open('./pic.png').convert('L') # Открытие изображение и
- конвертирование в grayscale
- central_line = get_central_line_and_quant (img) # Получение центральной линии пикселей и их
- квантование
- print(central_line) # Вывод
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement