user1667061
user1667061

Reputation: 128

Where do I add a scale factor to the Essential Matrix to produce a real world translation value

I'm working with OpenCV and python and would like to obtain the real world translation between two cameras. I'm using a single calibrated camera which is moving. I've already worked through feature matching, calculation of F via RANSAC, and calculation of E. To get the translation between cameras, I think I can use: w, u, vt = cv2.SVDecomp and then my t vector could be: t = u[:,2] An example output is:

[[ -1.16399893 9.78967574 1.40910252]
[ -7.79802049 -0.26646268 -13.85252956]
[ -2.67690676 13.89538682 0.19209676]]

t vector: [ 0.81586158 0.0750399 -0.57335756]

I think I understand how the translation is not in real world scale so I need to provide that scale somehow if I want a real world translation. If I do know the distance between the cameras, can I just apply it directly to my t vector by multiplication? I think I'm missing something here...

Upvotes: 1

Views: 842

Answers (2)

user4705465
user4705465

Reputation: 49

I have the same problem.I think the monocular camera may need a object known the 3D coordinate.That may help .

Upvotes: -1

user1667061
user1667061

Reputation: 128

It looks like the answer is 'yes'.

If the distance between cameras is 2m then the resulting real world translation would be the product of this value and the t vector:

dist = 2
t = [ 0.81586158 0.0750399 -0.57335756]
tworld = 2 * t

print tworld 
[ 1.63172316  0.1500798  -1.14671512]

Of course the thing to remember here is that while the translation is now in real world units, its still in the camera coordinate system from camera one. So this would mean my second camera is located 1.63172316m to the right, 0.1500798m up, and -1.14671512 behind camera one.

Upvotes: 2

Related Questions