Complete the code to convert an image to grayscale.
gray_image = cv2.[1](color_image, cv2.COLOR_BGR2GRAY)The function cvtColor converts the image color space, here from BGR to grayscale.
Complete the code to resize an image to 100x100 pixels.
resized_image = cv2.[1](original_image, (100, 100))
The resize function changes the image size to the given dimensions.
Fix the error in the code to apply a binary threshold to a grayscale image.
_, binary_image = cv2.[1](gray_image, 127, 255, cv2.THRESH_BINARY)
The threshold function applies a binary threshold to the grayscale image.
Fill in the blank to create a dictionary of pixel intensities for pixels greater than 100.
pixel_dict = { (x, y): image[x, y] for x in range(image.shape[0]) for y in range(image.shape[1]) if image[x, y] [1] 100 }The dictionary comprehension collects pixels with intensity greater than 100.
Fill all three blanks to create a dictionary of pixel intensities for pixels less than 50.
pixel_dict = { ([1], [2]): image[[1], [2]] for [1] in range(image.shape[0]) for [2] in range(image.shape[1]) if image[[1], [2]] [3] 50 }The dictionary comprehension uses variables x and y to iterate over image pixels and selects pixels with intensity less than 50.