0
0
Computer Visionml~10 mins

Why video extends CV to temporal data in Computer Vision - Test Your Understanding

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

Complete the code to load a video file using OpenCV.

Computer Vision
import cv2
video = cv2.VideoCapture([1])
Drag options to blanks, or click blank then click option'
A'video.mp4'
Bvideo.mp4
Copen('video.mp4')
Dcv2.VideoCapture('video.mp4')
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around the file name causes errors.
Passing the function call inside itself is incorrect.
2fill in blank
medium

Complete the code to read a frame from the video.

Computer Vision
ret, frame = video.[1]()
Drag options to blanks, or click blank then click option'
Aread_frame
Bget_frame
Ccapture
Dread
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-existent methods like read_frame() or get_frame().
3fill in blank
hard

Fix the error in the code to convert a frame to grayscale.

Computer Vision
gray = cv2.cvtColor(frame, [1])
Drag options to blanks, or click blank then click option'
Acv2.COLOR_RGB2GRAY
Bcv2.COLOR_BGR2GRAY
Ccv2.COLOR_GRAY2BGR
Dcv2.COLOR_BGR2RGB
Attempts:
3 left
💡 Hint
Common Mistakes
Using RGB to GRAY conversion when the image is BGR.
Using conversion codes that change color order instead of to grayscale.
4fill in blank
hard

Fill the blank to create a dictionary of frame numbers and their grayscale frames for frames where the frame number {{BLANK_1}} 10 and the frame is not None.

Computer Vision
frames_dict = {i: gray_frame for i, gray_frame in enumerate(frames) if i [1] 10 and gray_frame is not None}
Drag options to blanks, or click blank then click option'
A<
B>
C==
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using > or == instead of <.
Confusing the condition with frame content checks.
5fill in blank
hard

Fill all three blanks to create a list of frame differences between consecutive grayscale frames.

Computer Vision
diffs = [cv2.absdiff(frames[i], frames[i [1] [2]]) for i in range([3], len(frames))]
Drag options to blanks, or click blank then click option'
A-
B+
C1
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using addition instead of subtraction.
Starting range at 0 causing index errors.
Using wrong index offset.