MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / to_grayscale

Function to_grayscale

digital_image_processing/sepia.py:15–20  ·  view source on GitHub ↗

Helper function to create pixel's greyscale representation Src: https://pl.wikipedia.org/wiki/YUV

(blue, green, red)

Source from the content-addressed store, hash-verified

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"""

Callers 1

make_sepiaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected