所以我计算了2个立体图像(左右)之间的差异。看起来是正确的 (因为它在形状上与原始图像有些相似)。之后我使用了这一行: -
cvReprojectImageTo3D(&disparity, threeDimage, &Q);
并在threeDimage中得到答案。它是一个矩阵,我将其作为: -
访问for(int ii=0;ii<threeDimage->rows;ii++)
{
float *data = (float *)(threeDimage->data.ptr + ii * threeDimage->step);
for(int jj=0;jj<threeDimage->cols*3;jj=jj+3)
{
float a=data[jj];
float b=data[jj+1];
float c=data[jj+2];
fprintf(fpp,"%f %f %f \n", a,b,c);
}
}
但问题是它似乎没有给我一个正确的答案。我的文件中有很多重复的值。任何可能出错的提示?矩阵的遍历是否正确?
答案 0 :(得分:0)
您只能从视差图中存在边缘的点获得不同的3D距离。如果您有大面积相同的差异(输入图像中为灰色),那么它们将具有相同的Z.