我非常感谢以下问题的帮助:
从校准的立体声装置中捕获并校正了灰度图像。 我现在试图在左图中获得相对于左相机的特定点的真实世界x,y,z坐标;我正在尝试使用cvPerspectiveTransform来实现这一目标。
我的缩写代码如下。
代码似乎在某种程度上起作用,并返回以下4个数据点: (15.4510,-474.7451,-527.0327,-912.6536),我理解为代表x,y,z和w。
问题1)这个假设是否正确? - 它可能已经被w分割并且XYZ已经被返回,在这种情况下-912.6536是一个被忽略的人工制品 - 欢迎任何观点。
问题2)然而,如果为了实现真实世界坐标X,Y,Z,'x','y','z'中的每一个分别用'w'除以,得到的XYZ坐标是多少单位?我知道它们与校准中使用的“点”有关 - 在这种情况下,棋盘角相距2.5厘米,但是在这种情况下,物体相机的距离大约是60厘米...正如你可以看到数学不对不太好用。
我努力阅读Bradski书中的相关页面(并在线搜索),但我必须遗漏一些东西。
Matrix<float> inputMatLeft = new Matrix<float>(4,1,3);
inputMatLeft[0,0] = xL; // xL, a float, the x coord of a point in the left image
inputMatLeft[1,0] = yL; // yL, a float, the y coord of same point in left image
inputMatLeft[2,0] = d; // d, a float, the disparity between the same featurepoint in the left and right rectified images, is calc'd and defined elsewhere
inputMatLeft[3,0] = 1F;
Matrix<float> rwCoords = new Matrix<float>(4,1,3);
rwCoords = computeRealWorldCoords(inputMatLeft);
// ....do stuff with rwCoords
public Matrix<float> computeRealWorldCoords(Matrix <float> leftSrc)
{
Matrix<float> leftDest = new Matrix<float>(4,1,3);
CvInvoke.cvPerspectiveTransform(leftSrc, leftDest, inputMatrixQ); // Q Matrix is 4x4 float
return leftDest;
}
谢谢!