无法从 L/R 对获得正确的立体声

发布于 2024-10-21 22:26:17 字数 955 浏览 7 评论 0原文

LeftImage RightImage Stereo

我用左右图像运行以下代码并得到奇怪的结果。我不太确定我做错了什么。首先,为什么它被裁剪以及为什么视差都是一种颜色?

CvStereoBMState *BMState = cvCreateStereoBMState();
assert(BMState != 0);
BMState->preFilterSize=41;
BMState->preFilterCap=31;
BMState->SADWindowSize=41;
BMState->minDisparity=-64;
BMState->numberOfDisparities=128;
BMState->textureThreshold=10;
BMState->uniquenessRatio=5;

CvMat* disp = cvCreateMat(image_pyramid[0][0]->height, image_pyramid[0][0]->width, CV_16S);
CvMat* vdisp = cvCreateMat(image_pyramid[0][0]->height, image_pyramid[0][0]->width, CV_8U);

cvFindStereoCorrespondenceBM(image_pyramid[0][0], image_pyramid[1][0], disp, BMState);
cvNormalize(disp, vdisp, 0, 256, CV_MINMAX);
cvSaveImage("wowicantbelieveitsnotbutter.jpg", vdisp);

LeftImage RightImage Stereo

I run the following code with the left and the right images and get the strange result. I'm not exactly sure what I'm doing wrong. First of all, why is it cropped and why is the disparity all one color?

CvStereoBMState *BMState = cvCreateStereoBMState();
assert(BMState != 0);
BMState->preFilterSize=41;
BMState->preFilterCap=31;
BMState->SADWindowSize=41;
BMState->minDisparity=-64;
BMState->numberOfDisparities=128;
BMState->textureThreshold=10;
BMState->uniquenessRatio=5;

CvMat* disp = cvCreateMat(image_pyramid[0][0]->height, image_pyramid[0][0]->width, CV_16S);
CvMat* vdisp = cvCreateMat(image_pyramid[0][0]->height, image_pyramid[0][0]->width, CV_8U);

cvFindStereoCorrespondenceBM(image_pyramid[0][0], image_pyramid[1][0], disp, BMState);
cvNormalize(disp, vdisp, 0, 256, CV_MINMAX);
cvSaveImage("wowicantbelieveitsnotbutter.jpg", vdisp);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

悲念泪 2024-10-28 22:26:18

我不确定裁剪后的图像,但我认为您应该将其标准化为范围 0..1 而不是 0..255,因为它不是 8 位图像。

也可能它看起来被裁剪了,因为黑色值实际上是负值。

I am not sure about the cropped image but I think that you should normalize it to range 0..1 and not to 0..255 since it is not 8 bit image.

Also maybe it looks cropped since the black values are actually negative.

时光沙漏 2024-10-28 22:26:18

尝试将最小差异更改为零,这可能对您的情况有所帮助(由于裁剪而出现问题)。我确实遇到了同样的问题。但我带来了 BMTuner 的解决方案。我看过一个视频。在这里我附上视频,这可能会帮助您解决裁剪问题。

http://www.youtube.com/watch?feature=player_embedded&v=FX7AMktf24E

Try changing min disparity to zero this may help in your case(problem due to cropping). I did face the same problem. But I came with a solution of BMTuner. I have seen a video. Here I attach video this may help you with problem of cropping.

http://www.youtube.com/watch?feature=player_embedded&v=FX7AMktf24E

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文