Helper function to create pixel's greyscale representation Src: https://pl.wikipedia.org/wiki/YUV
(blue, green, red)
| 13 | pixel_h, pixel_v = img.shape[0], img.shape[1] |
| 14 | |
| 15 | def to_grayscale(blue, green, red): |
| 16 | """ |
| 17 | Helper function to create pixel's greyscale representation |
| 18 | Src: https://pl.wikipedia.org/wiki/YUV |
| 19 | """ |
| 20 | return 0.2126 * red + 0.587 * green + 0.114 * blue |
| 21 | |
| 22 | def normalize(value): |
| 23 | """Helper function to normalize R/G/B value -> return 255 if value > 255""" |