Complete the code to increase the brightness of an image by adding a value to all pixels.
bright_img = img + [1]Adding 50 to all pixel values increases brightness by a fixed amount.
Complete the code to adjust contrast by multiplying pixel values by a factor.
contrast_img = img * [1]Multiplying by 1.5 increases contrast by making bright pixels brighter and dark pixels darker.
Fix the error in the code to correctly convert an RGB image to HSV and adjust the hue.
hsv_img = cv2.cvtColor(img, [1]) hsv_img[:, :, 0] = (hsv_img[:, :, 0] + 10) % 180
Use cv2.COLOR_RGB2HSV to convert from RGB to HSV color space before adjusting hue.
Fill both blanks to create a function that adjusts brightness and contrast of an image.
def adjust_brightness_contrast(img, brightness, contrast): return img * [1] + [2]
The formula for brightness and contrast adjustment is: new_img = img * contrast + brightness.
Fill all three blanks to adjust hue, saturation, and value in an HSV image.
hsv_img[:, :, 0] = (hsv_img[:, :, 0] + [1]) % 180 hsv_img[:, :, 1] = hsv_img[:, :, 1] * [2] hsv_img[:, :, 2] = hsv_img[:, :, 2] * [3]
Hue is shifted by 10 degrees (mod 180), saturation is increased by 20%, and value is decreased by 20%.