Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to load images for stitching.
Drone Programming
images = [cv2.imread([1]) for file in image_files]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the list name instead of the loop variable.
Using the wrong variable name that does not hold filenames.
✗ Incorrect
The variable file holds each filename in the list image_files. We use it to load each image with cv2.imread().
2fill in blank
mediumComplete the code to initialize the stitcher object.
Drone Programming
stitcher = cv2.Stitcher_create([1]) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using image reading or color conversion constants instead of stitcher mode.
Passing no argument or wrong argument type.
✗ Incorrect
cv2.STITCHER_PANORAMA tells the stitcher to create a panorama from images.
3fill in blank
hardFix the error in the code to stitch images correctly.
Drone Programming
status, stitched = stitcher.[1](images) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect method names like 'combine' or 'merge'.
Trying to call a non-existent method.
✗ Incorrect
The correct method to stitch images in OpenCV is stitch().
4fill in blank
hardFill both blanks to check if stitching was successful and save the result.
Drone Programming
if status == [1]: cv2.[2]('stitched_output.jpg', stitched)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing status codes for success.
Using asynchronous save function which is not standard.
✗ Incorrect
In OpenCV stitching, 0 (cv2.Stitcher_OK) means success. We use cv2.imwrite to save the image.
5fill in blank
hardFill all three blanks to create a dictionary of image sizes for mapping.
Drone Programming
image_sizes = [1]((file, (img.shape[[2]], img.shape[[3]])) for file, img in zip(image_files, images))
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using list or set instead of dict.
Mixing up height and width indices.
✗ Incorrect
We use dict to create a dictionary. img.shape[0] is height and img.shape[1] is width of the image.