Matlab立体相机标定场景重建误差

4

我正在尝试使用计算机视觉系统工具箱来校准下面的一对摄像头,以便能够在1到5米范围内生成车辆的三维点云。这些检查板标定图像的输出图像大小约为每张1 MB,检查板方格尺寸为25毫米。所使用的摄像头是一对SJ4000 HD1080P摄像头。这些摄像头被尽可能平行地放置在一起,并且垂直轴上没有任何角度。通过明亮的灯光和白板辅助进行了检查板标定。使用立体相机校准器代码时每个像素的平均误差为3.31,有31/32次成功配对。检查板距离大约为30厘米,相机之间的距离为20厘米。 enter image description here 在矫正过程中遇到的问题是场景的三维重建。下面的图是输出的结果。我不确定相机设置中是否缺少参数,或者脚本中是否缺少/需要添加某些内容。下面是用于立体眼镜和场景重建的代码,该代码改编自Matlab立体相机校准教程。
% Read in the stereo pair of images.
I1 = imread('left.jpg');
I2 = imread('right.jpg');

% Rectify the images.
[J1, J2] = rectifyStereoImages(I1, I2, stereoParams);

% Display the images before rectification.
figure;
imshow(stereoAnaglyph(I1, I2), 'InitialMagnification', 50);
title('Before Rectification');

% Display the images after rectification.
figure;
imshow(stereoAnaglyph(J1, J2), 'InitialMagnification', 50);
title('After Rectification');
% 
% Compute Disparity for 3-D Reconstruction 
% The distance in pixels between corresponding points in the rectified images is called disparity. 
% The disparity is used for 3-D reconstruction, because it is proportional to the distance between the cameras and the 3-D world point.
disparityMap = disparity(rgb2gray(J1), rgb2gray(J2));
figure;
imshow(disparityMap, [0, 64], 'InitialMagnification', 50);
colormap('jet');
colorbar;
title('Disparity Map');

%Reconstruct the 3-D Scene
%Reconstruct the 3-D world coordinates of points corresponding to each pixel     from the disparity map.

point3D = reconstructScene(disparityMap, stereoParams);

% Convert from millimeters to meters.
point3D = point3D / 1000;

% Visualize the 3-D Scene
% Plot points between 3 and 7 meters away from the camera.
z = point3D(:, :, 3);
zdisp = z;
point3Ddisp = point3D;
point3Ddisp(:,:,3) = zdisp;
showPointCloud(point3Ddisp, J1, 'VerticalAxis', 'Y',...
    'VerticalAxisDir', 'Down' );
xlabel('X');
ylabel('Y');
zlabel('Z');

我已经包含了场景重建、视差图、每像素平均误差和矫正后的图片。我使用的Matlab版本是从Matlab网站购买的R2014b学生版。

Scene Reconstruction

Mean Error per Pixel

After Rectification

Disparity Map

2个回答

2
  • 我认为最明显的问题是,在立体标定中,您得到了超过3个像素的重新投影误差,这表明存在校准问题。建议您重新进行校准,以获得更小的重新投影误差(对于良好的重建结果,应明显低于1个像素)。
  • 关于您的校准,另一个问题是:您使用了什么镜头畸变模型?我相信您那里有鱼眼镜头 - 我不确定Matlab工具箱知道如何处理这些。

嗨,ezfn。感谢您的回答。相机是类似GoPro的相机,并且没有采用透镜畸变模型。我该如何实现这个透镜畸变模型? - Giacinto Rittgers
嗨。看这里:https://sites.google.com/site/scarabotix/ocamcalib-toolbox。这将帮助您单独校准每个相机。如果您仍然想使用Matlab工具箱,请参考此链接http://www.mathworks.com/help/vision/ref/estimatecameraparameters.html,特别是“对于严重的畸变,例如广角镜头,请选择3个系数以包括k3”。 - ezfn

1
你有两个问题。其中一个,正如@ezfn指出的那样,是镜头畸变可能过于严重。在这里尝试更多校准图像以使棋盘格靠近视野的边缘和角落。此外,请尝试将棋盘格放置在距摄像机不同的距离处。看看是否可以将这些重新投影误差降低。
第二个问题是需要更改“disparity”函数的“DisparityRange”参数。使用“imtool”显示立体照片,并使用标尺小部件测量一些相应点之间的距离。这应该会给您关于视差范围的想法。仅从图像上看,我可以看到[0 64]太小了。

我认为仅仅在边缘附近拍摄更多带有棋盘格的图像是不够的,除非您正确考虑镜头畸变模型。这是一个处理此模型的工具箱示例:https://sites.google.com/site/scarabotix/ocamcalib-toolbox。 我认为Matlab工具箱也以某种方式处理它-可以从这里推导出:http://www.mathworks.com/help/vision/ref/estimatecameraparameters.html - ezfn

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接