0

我目前正在使用 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));
}

除了视差图中的黑色左边框外,这工作正常,如下所示:

左侧有黑色边框的视差图

如您所见,输入图像是这两个未校正的;): 未校正的图像 右未校正图像

所以我现在的问题是:这是正常行为吗?或者你有没有看到我到目前为止所做的任何错误?作为另一个信息,整改工作正常

4

2 回答 2

0

缺失区域的宽度等于 stereo_bm 中使用的视差数量。它是正常的副产品stereo_bm algorithm

于 2012-11-08T04:09:33.220 回答
0

我认为发生这种情况是因为该算法通过将左侧图像中像素周围的块与右侧图像中同一行中的像素周围的块进行匹配来计算视差(假设图像已被校正)。由于存在一个区域,左摄像头和右摄像头的视图之间没有重叠,因此该算法无法找到该区域内像素周围的块的匹配。“缺失”区域的宽度等于参数“视差数”,因为算法在“视差数”尝试后放弃了尝试匹配给定块(与左图像中的像素在同一水平行中)。如果我不够清楚,我很抱歉。如果您想了解有关其工作原理的更多详细信息,请参阅http://siddhantahuja.wordpress.com/2010/04/11/correlation-based-similarity-measures-summary/

于 2014-03-17T22:05:41.470 回答