【发布时间】:2012-09-09 13:59:53
【问题描述】:
我目前正在使用 opencv2.3 和 Pointgrey Bumblebee2 立体摄像机作为输入设备进行立体处理。获取图像是通过 libdc1394 完成的。
我的整流和立体声处理代码如下:
void StereoProcessing::calculateDisparityMap(const Mat &left, const Mat &right, Mat &disparity_map)
Mat map11, map12, map21, map22, left_rectified, right_rectified, disp16;
// Computes the undistortion and rectification transformation maps
initUndistortRectifyMap(this->camera_matrix1,
this->distance_coefficients1,
this->R1,
this->P1,
this->output_image_size,
CV_16SC2,
map11,
map12);
initUndistortRectifyMap(this->camera_matrix2,
this->distance_coefficients2,
this->R2,
this->P2,
this->output_image_size,
CV_16SC2,
map21,
map22);
// creates rectified images
remap(left, left_rectified, map11, map12, INTER_LINEAR);
remap(right, right_rectified, map21, map22, INTER_LINEAR);
// calculates 16-bit disparitymap
this->stereo_bm(left_temp, right_temp, disp16);
disp16.convertTo(disparity_map, CV_8U, 255 / (this->stereo_bm.state->numberOfDisparities * 16.0));
}
这工作正常,除了视差图中的黑色左边框,如下所示:
输入图像是这两个 - 如您所见;):
所以我现在的问题是: 这是正常行为吗?或者你有没有看到我到目前为止所做的任何错误? 作为另一个信息,整改工作正常
【问题讨论】:
-
您可以使用循环访问您的像素,其中行和列倒置?
-
我不访问像素,除了提到的 opencv 函数,它们从输入图像中获取图像大小,所以我猜没有:(
-
这是什么->output_image_size ?
标签: c++ opencv disparity-mapping