【发布时间】: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