Joseph Drackey

Generation

generate functionTue, 28 Mar 2023

Converts an image to grayscale using the crude average of the r, g, and b

def convert_to_grayscale(image): gray_image = image.copy() gray_image[:, :, 0] = .2126 * image[:, :, 0] gray_image[:, :, 1] = .7152 * image[:, :, 1] gray_image[:, :, 2] = .0722 * image[:, :, 2] return gray_image

Questions about programming?Chat with your personal AI assistant