我目前正在使用 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));
}
除了视差图中的黑色左边框外,这工作正常,如下所示:
如您所见,输入图像是这两个未校正的;):
所以我现在的问题是:这是正常行为吗?或者你有没有看到我到目前为止所做的任何错误?作为另一个信息,整改工作正常