0
0
Drone Programmingprogramming~20 mins

ArUco marker landing in Drone Programming - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
ArUco Marker Landing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
Detecting ArUco Marker IDs
What will be the output of this code snippet that detects ArUco markers and prints their IDs?
Drone Programming
import cv2
import cv2.aruco as aruco

# Load a sample image with ArUco markers
image = cv2.imread('markers.jpg')

# Convert to grayscale
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

# Define dictionary and parameters
aruco_dict = aruco.Dictionary_get(aruco.DICT_4X4_50)
parameters = aruco.DetectorParameters_create()

# Detect markers
corners, ids, rejectedImgPoints = aruco.detectMarkers(gray, aruco_dict, parameters=parameters)

print(ids)
A[[23], [7], [15]]
B[23, 7, 15]
CSyntaxError
DNone
Attempts:
2 left
💡 Hint
Remember that the ids returned by detectMarkers is a numpy array of shape (N,1).
🧠 Conceptual
intermediate
1:30remaining
Understanding Pose Estimation Output
After detecting an ArUco marker, the pose estimation function returns rotation and translation vectors. What do these vectors represent?
ABoth vectors show the marker's position in GPS coordinates
BRotation vector shows camera's orientation; translation vector shows camera's position relative to the marker
CThey represent the marker's color and size
DRotation vector shows marker's orientation; translation vector shows marker's position relative to the camera
Attempts:
2 left
💡 Hint
Think about how the camera sees the marker in 3D space.
🔧 Debug
advanced
2:30remaining
Fixing Marker Detection Failure
This code fails to detect any ArUco markers in a live video feed. What is the most likely cause?
Drone Programming
import cv2
import cv2.aruco as aruco

cap = cv2.VideoCapture(0)

while True:
    ret, frame = cap.read()
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    aruco_dict = aruco.Dictionary_get(aruco.DICT_6X6_250)
    parameters = aruco.DetectorParameters_create()
    corners, ids, _ = aruco.detectMarkers(gray, aruco_dict, parameters=parameters)
    if ids is not None:
        print('Markers detected:', ids)
    else:
        print('No markers detected')
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

cap.release()
cv2.destroyAllWindows()
AThe dictionary used (DICT_6X6_250) does not match the markers in the scene
BThe video capture device is not opened properly
CThe grayscale conversion is incorrect
DThe waitKey function is missing
Attempts:
2 left
💡 Hint
Check if the marker dictionary matches the actual markers you want to detect.
📝 Syntax
advanced
1:30remaining
Correcting Pose Estimation Syntax
Which option correctly calls the pose estimation function for an ArUco marker?
Drone Programming
rvec, tvec, _ = aruco.estimatePoseSingleMarkers(corners, markerLength, cameraMatrix, distCoeffs)
Arvec, tvec = aruco.estimatePoseSingleMarkers(corners, markerLength, cameraMatrix, distCoeffs)
Brvec, tvec, _ = aruco.estimatePoseSingleMarkers(corners, markerLength, cameraMatrix, distCoeffs)
Crvec, tvec, _ = aruco.estimatePoseSingleMarkers(corners, markerLength, distCoeffs, cameraMatrix)
Drvec, tvec, _ = aruco.estimatePoseSingleMarkers(markerLength, corners, cameraMatrix, distCoeffs)
Attempts:
2 left
💡 Hint
Check the order and number of returned values from the function.
🚀 Application
expert
3:00remaining
Calculating Drone Landing Coordinates
Given the translation vector tvec = [[0.5, -0.2, 1.5]] meters from the camera to the ArUco marker, and the drone's current GPS coordinates (lat: 40.0, lon: -74.0), which option best describes how to calculate the drone's GPS coordinates to land on the marker?
AAdd tvec values directly to latitude and longitude values
BUse only the z component of tvec to adjust altitude, ignore x and y
CConvert tvec from camera frame to world frame, then convert meters offset to GPS offset and add to current GPS coordinates
DIgnore tvec and land at current GPS coordinates
Attempts:
2 left
💡 Hint
Think about coordinate frames and unit conversions between meters and GPS degrees.