无法从 L/R 对获得正确的立体声
我用左右图像运行以下代码并得到奇怪的结果。我不太确定我做错了什么。首先,为什么它被裁剪以及为什么视差都是一种颜色?
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);
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定裁剪后的图像,但我认为您应该将其标准化为范围 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.
尝试将最小差异更改为零,这可能对您的情况有所帮助(由于裁剪而出现问题)。我确实遇到了同样的问题。但我带来了 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