Challenge - 5 Problems
ArUco Marker Landing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediateDetecting 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)
Attempts:
2 left
💡 Hint
Remember that the ids returned by detectMarkers is a numpy array of shape (N,1).
✗ Incorrect
The detectMarkers function returns ids as a numpy array with shape (N,1), so printing ids shows a list of lists like [[23], [7], [15]].
🧠 Conceptual
intermediateUnderstanding Pose Estimation Output
After detecting an ArUco marker, the pose estimation function returns rotation and translation vectors. What do these vectors represent?
Attempts:
2 left
💡 Hint
Think about how the camera sees the marker in 3D space.
✗ Incorrect
The rotation vector describes how the marker is rotated relative to the camera, and the translation vector describes where the marker is located relative to the camera.
🔧 Debug
advancedFixing 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()
Attempts:
2 left
💡 Hint
Check if the marker dictionary matches the actual markers you want to detect.
✗ Incorrect
If the dictionary used in detectMarkers does not match the actual marker type in the scene, no markers will be detected.
📝 Syntax
advancedCorrecting 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)
Attempts:
2 left
💡 Hint
Check the order and number of returned values from the function.
✗ Incorrect
The function returns three values: rotation vectors, translation vectors, and object points. The order of parameters must be corners, markerLength, cameraMatrix, distCoeffs.
🚀 Application
expertCalculating 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?
Attempts:
2 left
💡 Hint
Think about coordinate frames and unit conversions between meters and GPS degrees.
✗ Incorrect
The translation vector is relative to the camera frame; it must be transformed to the world frame and converted from meters to GPS degrees before adjusting the drone's GPS position.
