Ask Your Question

Revision history [back]

Using the RGBDOdometry sample correctly

Hi everyone, playing around with how to find the egomotion of a camera, particularly a kinect sensor. One approach I've looked at is the sample packed with opencv, 'rgbdodometry' which sprouts from this paper: https://vision.in.tum.de/_media/spezial/bib/steinbruecker_sturm_cremers_iccv11.pdf I believe.

However, other than that I can find very little documentation on it. It seems to return the projection matrix [R|t] between the camera views?

In an attempt to extract these values I tried:

bool isFound = cv::RGBDOdometry(Rt, oldRt, image0, depthFlt0, mask0, image1, depthFlt1, mask1, cameraMatrix, minDepth, maxDepth, maxDepthDiff, iterCounts, minGradMagnitudes, transformationType );
Mat rot, trans, rX, rY, rZ, rE, K;
Mat P = Rt.rowRange(0,3);
cout << P << endl;
decomposeProjectionMatrix(P, K, rot, trans, rX, rY, rZ, rE);
cout << "Rotated [x,y,z]: " << rE << endl << "Tranformed [x,y,z]: " << trans << endl;

On the hoof that it might work, but I'm pretty sure it doesn't. The camera matrix K that is returned, is nothing like the cameraMatrix I use with the RGBDOdometry function (calibrated before).

I have read the full projection matrix is K[R|t], which would make sense why I am getting an invalid K, if I only had [R|t] to begin with!

Ideally, all I'm looking for now is a rough guess as to how the camera is moving, and I'd probably output that drawing the camera path in a separate window, (ignoring changes in Y).

Is this possible?