【问题标题】:Matlab Stereo Camera Calibration Scene Reconstruction ErrorMatlab立体相机标定场景重建误差
【发布时间】:2015-11-08 16:09:31
【问题描述】:

我正在尝试使用计算机视觉系统工具箱来校准下面的一对摄像头,以便能够在 1 到 5m 的范围内生成车辆的 3D 点云。对于棋盘校准图像,输出图像大小约为每张图像 1 MB,棋盘正方形大小为 25 mm。使用的摄像机是一对 SJ4000 HD1080P 摄像机。摄像机尽可能相互平行放置,在垂直轴上没有角度。棋盘校准是在强光和白板的帮助下完成的。使用立体相机校准器代码的每个像素的平均误差为 3.31,配对成功率为 31/32。到棋盘的大致距离为 30 厘米,摄像机之间的距离为 20 厘米。 我在整改时遇到的问题是在场景的 3D 重建期间。下图是输出的。我不确定相机设置中是否缺少参数,或者脚本中是否缺少/需要添加的内容。下面是用于立体立体图和场景重建的代码,改编自 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 学生版。

【问题讨论】:

    标签: matlab camera camera-calibration matlab-cvst 3d-reconstruction


    【解决方案1】:

    这里有两个问题。正如@ezfn 指出的那样,其中之一是镜头失真可能太严重了。在这里尝试的最佳方法是拍摄更多校准图像,以便棋盘靠近视野的边缘和角落。此外,请尝试将棋盘放置在距相机不同的距离处。看看你是否可以减少这些重投影错误。

    这里的第二个问题是你需要改变disparity函数的'DisparityRange'参数。使用imtool 显示立体图像,并使用标尺小部件测量一些对应点对之间的距离。这应该让您了解差异范围应该是什么。只看图片我就发现 [0 64] 太小了。

    【讨论】:

    【解决方案2】:
    • 我认为这里最明显的问题是重新投影 立体校准中出现的错误(超过 3 个像素),点 到校准问题。我建议您重新校准以获得 更小的重投影误差(应该显着低于 1 像素 以获得良好的重建结果)。
    • 关于校准的另一个问题:什么镜头失真 你用的型号?我相信你那里有鱼眼镜头 - 我 我不确定 Matlab 工具箱是否知道如何处理这些问题。

    【讨论】:

    猜你喜欢
    • 2021-09-01
    • 2014-08-30
    • 2018-06-27
    • 1970-01-01
    • 1970-01-01
    • 2017-12-31
    • 2018-03-08
    • 2021-12-30
    相关资源
    最近更新 更多