简体   繁体   English

视差图中的缺失区域

[英]missing region in disparity map

i am currently working on stereo processing using opencv2.3 and a Pointgrey Bumblebee2 stereocamera as an input device. 我目前正在使用opencv2.3和Pointgrey Bumblebee2立体相机作为输入设备进行立体声处理。 Acquiring images is done via the libdc1394 . 通过libdc1394获取图像。

My code for rectification and stereo processing is the following: 我的整流和立体声处理代码如下:

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));
}

This works fine except for a black left border in the disparity map, which is the following: 除视差图中的黑色左边框(如下所示)外,此方法均正常运行:

左侧有黑色边框的视差图

The input images are these two - unrectified as you can see ;) : 输入图像是这两个 - 未校正的,你可以看到): 左未校正的图像正确的未校正图像

So my question is now: Is this normal behaviour? 现在我的问题是:这是正常行为吗? Or do you see any mistake i have done so far? 还是您看到我到目前为止所做的任何错误? As another information, the rectification works fine 另外,整改效果很好

The width of the missing region is equivalent to the number of disparities used in stereo_bm. 缺失区域的宽度等于stereo_bm中使用的视差数量。 It is a normal by-product of stereo_bm algorithm . 它是stereo_bm algorithm的正常副产品。

I think this happens because the algorithm computes the disparity by matching blocks around pixels from the left image to blocks around pixels in the same row in the right image (assuming images are rectified). 我认为发生这种情况是因为该算法通过将左图像中像素周围的块与右图像中同一行中的像素周围的块进行匹配来计算视差(假设图像已得到纠正)。 Since there is a region where there is no overlap between the views from the left camera and the right camera, the algorithm can't find a match for the blocks around pixels within this region. 由于左摄像机和右摄像机的视图之间没有重叠区域,因此该算法无法找到该区域内像素周围块的匹配项。 The width of the "missing" region equals the parameter "number of disparities" because the algorithm gives up trying to match a given block after "number of disparities" attempts (in the same horizontal row as the pixel in the left image). “缺失”区域的宽度等于参数“视差数量”,因为该算法放弃了在“视差数量”尝试之后(与左侧图像中的像素在同一水平行中)尝试匹配给定块的尝试。 I'm sorry if I wasn't clear enough. 对不起,我很抱歉。 If you wish to get more details about how it works, there is some code in http://siddhantahuja.wordpress.com/2010/04/11/correlation-based-similarity-measures-summary/ . 如果您希望获得有关其工作方式的更多详细信息,请参见http://siddhantahuja.wordpress.com/2010/04/11/correlation-based-similarity-measures-summary/中的一些代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM