从视差获取 3D 点时出错
所以我计算了两个立体图像(左和右)之间的视差。它看起来是正确的 (因为它的形状与原始图像有些相似)。在此之后,我使用行 :-
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);
}
}
但问题是它似乎没有给我正确的答案。我的文件中有很多重复的值。有关可能出现问题的任何提示吗?矩阵的遍历是否正确?
So I calculate the disparity between 2 stereo images(left and right).It looks correct
(because it is somewhat similar in shape to the original image).After this I use the line :-
cvReprojectImageTo3D(&disparity, threeDimage, &Q);
and get the answers in threeDimage.It is a matrix and I access it as :-
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);
}
}
But the problem is it doesnt seem to give me a correct answer.I get lot of repeated values in my file.Any hint on what might be going wrong?Is the traversal of the matrix correct?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您只能从视差图中存在边缘的点获得不同的 3D 距离。如果您有大面积的相同视差(输入图像中的平坦灰色),那么它们将具有相同的 Z。
You can only get a different 3D distance from points where there is an edge in the disparity map. If you have large areas of the same disparity (flat grey in the input image) then they will have the same Z.