Simon
Simon

Reputation: 1870

Get the real distance between two OpenCV ArUco markers

How can I get the real distance between two ArUco markers in a frame?

Upvotes: 0

Views: 2006

Answers (1)

Simon
Simon

Reputation: 1870

1) Get tvec

First we need to get the tvec of each marker like seen in this one: How to get distance from camera to marker with ArUco

2) Euclidean distance

Once we have both tvec 's of both markers in the frame we can simply use the Euclidean distance formula to retrieve the distance between both markers in the 3D space. Be aware that the unit you'll receive is the same as the one you provided for the real maker size to get the tvec.

Numpy provides a method to retrieve the euclidian distance.

np.linalg.norm(tvec1-tvec2)

Upvotes: 1

Related Questions