Complete the code to capture an image from the drone's camera.
image = drone.camera.[1]()The capture() method takes a photo from the drone's camera.
Complete the code to convert the captured image to grayscale.
gray_image = drone.camera.[1](image)The grayscale() method converts the image to shades of gray, which helps in line detection.
Fix the error in the code to detect edges in the grayscale image.
edges = drone.camera.[1](gray_image)The detect_edges() method finds the edges in the grayscale image, which is essential for line following.
Fill both blanks to create a dictionary of line positions and their lengths from detected edges.
line_data = {pos: [1] for pos in edges if edges[pos] [2] 0}The dictionary comprehension uses edges[pos] as the value and filters positions where edge length is greater than zero.
Fill all three blanks to control the drone's movement based on line position and length.
if line_data.get([1]) [2] [3]: drone.move_forward()
The code checks if the line at the center position has length greater than 10, then moves the drone forward.