Search⌘ K
AI Features

Find Distances Between the Camera and Markers

Explore how to detect ArUco markers in images using Python and OpenCV, then calculate distances from the camera to markers and between markers. Understand key functions for pose estimation and how to process and visualize results.

The first piece of the code below loads an image with ArUco markers, detects the ArUco markers in the image, and then calculates the distances from each marker to the camera’s center.

The second Python code will calculate the pairwise distances between detected ArUco markers in the image.

We’ll use an image that contains two Aruco markers. The centers of these markers are at a distance of approximately 19 cm from each other, and the camera was held approximately 60 cm away.

The image with ArUco markers that we'll be using in this lesson
The image with ArUco markers that we'll be using in this lesson
...