0
0
Computer Visionml~10 mins

Image inpainting concept in Computer Vision - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to load an image using OpenCV.

Computer Vision
import cv2
image = cv2.[1]('input.jpg')
Drag options to blanks, or click blank then click option'
Aimshow
Bresize
Cimwrite
Dimread
Attempts:
3 left
💡 Hint
Common Mistakes
Using cv2.imshow instead of cv2.imread
Trying to write the image instead of reading it
2fill in blank
medium

Complete the code to create a mask for the inpainting process.

Computer Vision
import numpy as np
mask = np.zeros(image.shape[:2], dtype=[1])
Drag options to blanks, or click blank then click option'
Afloat32
Buint8
Cbool
Dint32
Attempts:
3 left
💡 Hint
Common Mistakes
Using float32 which is not accepted as mask type
Using bool which may cause errors in OpenCV
3fill in blank
hard

Fix the error in the inpainting function call to use the correct method.

Computer Vision
result = cv2.inpaint(image, mask, 3, [1])
Drag options to blanks, or click blank then click option'
Acv2.INPAINT_TELEA
Bcv2.INPAINT_NS
Ccv2.INPAINT_FAST
Dcv2.INPAINT_BASIC
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-existent constants like INPAINT_FAST or INPAINT_BASIC
Using INPAINT_NS which is another method but less common
4fill in blank
hard

Fill both blanks to create a mask where pixels with value 0 are marked for inpainting.

Computer Vision
mask = np.where(image_gray [1] 0, [2], 0).astype(np.uint8)
Drag options to blanks, or click blank then click option'
A==
B255
C1
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' instead of '=='
Setting mask pixels to 1 instead of 255
5fill in blank
hard

Fill all three blanks to apply inpainting and display the result using OpenCV.

Computer Vision
result = cv2.inpaint([1], [2], 3, [3])
cv2.imshow('Inpainted Image', result)
cv2.waitKey(0)
cv2.destroyAllWindows()
Drag options to blanks, or click blank then click option'
Aimage
Bmask
Ccv2.INPAINT_TELEA
Dcv2.INPAINT_NS
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping image and mask arguments
Using wrong inpainting method constant