daily pastebin goal
37%
SHARE
TWEET

Untitled

a guest Dec 16th, 2018 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from PIL import Image
  2. from PIL.PngImagePlugin import PngImageFile
  3. def get_central_line_of_pixels(img: PngImageFile):
  4. pixels = []
  5. for i in range(img.width):
  6. pixels.append(img.getpixel((i, img.height//2)))
  7. pixels[i] = round(pixels[i] / 20) * 20
  8. return pixels
  9. def main():
  10. img: PngImageFile = Image.open('./pic.png').convert('L') # Открытие изображение и
  11. конвертирование в grayscale
  12. central_line = get_central_line_and_quant (img) # Получение центральной линии пикселей и их
  13. квантование
  14. print(central_line) # Вывод
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top