Distance between 2 aruco markers

I have a use case where I want to measure the real-world distance between 2 Aruco markers of a known size. I have tried the below but I’m getting some unusual measurements, it could be to do with poor camera calibration but i just wanted to check if my logic sounded ok.

I am capturing an image then using DetectMarkers to check if 2 and only 2 Aruco markers with the id 1 and 2 are seen. If they are I am running EstimatePoseSingleMarkers. Then using the returned tvec values for the 2 markers I’m doing the below.

sqrt((Math.Pow(x1 - x2, 2) + Math.Pow(y1 - y2, 2)));

Where x1 and y1 are the marker 1’s tvec x and y cords and x2 and y2 are marker 2’s tvec x and y cords.

Sorry for the question but just wanted to check im in the right ballpark before i spend more time on improving the odd results.

why no Z?

also, why not simply `cv::norm(tvec1 - tvec2)`?

you also need to make sure aruco gives you the center of a marker. if it gives you a corner of a marker… you’re merely calculating the distance between their respective corners, which the positions of which depend on each marker’s orientation in space.