Complete the code to load an image using OpenCV.
import cv2 image = cv2.[1]('input.jpg')
The cv2.imread function loads an image from a file into memory.
Complete the code to create a mask for the inpainting process.
import numpy as np mask = np.zeros(image.shape[:2], dtype=[1])
The mask for inpainting is usually an 8-bit unsigned integer array where non-zero pixels mark areas to inpaint.
Fix the error in the inpainting function call to use the correct method.
result = cv2.inpaint(image, mask, 3, [1])
cv2.INPAINT_TELEA is a common and effective inpainting algorithm provided by OpenCV.
Fill both blanks to create a mask where pixels with value 0 are marked for inpainting.
mask = np.where(image_gray [1] 0, [2], 0).astype(np.uint8)
This code marks pixels equal to 0 in the grayscale image with 255 in the mask, indicating areas to inpaint.
Fill all three blanks to apply inpainting and display the result using OpenCV.
result = cv2.inpaint([1], [2], 3, [3]) cv2.imshow('Inpainted Image', result) cv2.waitKey(0) cv2.destroyAllWindows()
The cv2.inpaint function requires the original image, the mask, and the inpainting method (here INPAINT_TELEA).