【问题标题】:warped/curved point clouds翘曲/弯曲的点云
【发布时间】:2015-01-10 01:55:38
【问题描述】:

我正在使用校准的立体对进行稀疏重建。这是我一步一步采取的方法:

1- 我使用 MATLAB 中的 Stereo Camera Calibrator 应用校准了立体相机。

2- 我拍摄了一对立体图像并对每张图像进行了无失真处理。

3- I 检测、提取和匹配点特征。

4- 我使用 MATLAB 中的 triangulate 函数通过将 stereoParametes 对象传递给 triangulate 来获取匹配点的 3D 坐标。生成的 3D 坐标相对于相机 1(右相机)的光学中心,以毫米为单位。

问题在于点云似乎向图像边缘弯曲和弯曲。起初,对我来说,这似乎是镜头的桶形失真。所以我使用 MATLAB 相机校准器应用程序重新校准了 bumblebee XB3 相机。但这次我使用了 3 个径向畸变系数,还包括了切向和倾斜参数。但结果是一样的。我还尝试了 Caltech 的相机校准工具箱,但它的结果与 MATLAB 相同。两个工具箱中的径向畸变系数相似。另一个问题是点云中的 Z 值都是负数,但我认为这可能是因为我使用右摄像头作为摄像头 1,左摄像头作为摄像头 2,而不是 MATLAB 的坐标系在附上的链接。

我附上了几张来自稀疏和密集 3D 重建的 3D 点云图片。我对 Dense 3D 不感兴趣,只是想看看问题是否仍然存在。我相信这意味着主要问题在于图像和相机校准而不是算法。

现在我的问题是:

1- 产生扭曲/弯曲的 3D 点云的主要原因/原因是什么?是仅相机校准还是其他步骤也可能引入错误?我该如何检查?

2- 除了 MATLAB 和 Caltech 之外,您能否推荐另一个相机校准工具箱?也许一种更适合径向扭曲?

谢谢

图片:

链接:

coordinate system

代码:

clear
close all
clc

load('mystereoparams.mat');
I11 = imread('Right.tif');
I22 = imread('Left.tif');
figure, imshowpair(I11, I22, 'montage');
title('Pair of Original Images');

[I1, newOrigin1] = undistortImage(I11,stereoParams.CameraParameters1);
[I2, newOrigin2] = undistortImage(I22,stereoParams.CameraParameters2);
figure, imshowpair(I1, I2, 'montage');
title('Undistorted Images');

% Detect feature points
imagePoints1 = detectSURFFeatures(rgb2gray(I1), 'MetricThreshold', 600);
imagePoints2 = detectSURFFeatures(rgb2gray(I2), 'MetricThreshold', 600);

% Extract feature descriptors
features1 = extractFeatures(rgb2gray(I1), imagePoints1);
features2 = extractFeatures(rgb2gray(I2), imagePoints2);

% Visualize several extracted SURF features
figure;
imshow(I1);
title('1500 Strongest Feature Points from Image1');
hold on;
plot(selectStrongest(imagePoints1, 1500));

indexPairs = matchFeatures(features1, features2, 'MaxRatio', 0.4);
matchedPoints1 = imagePoints1(indexPairs(:, 1));
matchedPoints2 = imagePoints2(indexPairs(:, 2));

% Visualize correspondences
figure;
showMatchedFeatures(I1, I2, matchedPoints1, matchedPoints2,'montage');
title('Original Matched Features from Globe01 and Globe02');

% Transform matched points to the original image's coordinates
matchedPoints1.Location = bsxfun(@plus, matchedPoints1.Location, newOrigin1);
matchedPoints2.Location = bsxfun(@plus, matchedPoints2.Location, newOrigin2);

[Cloud, reprojErrors] = triangulate(matchedPoints1, matchedPoints2, stereoParams);
figure;plot3(Cloud(:,1),Cloud(:,2),Cloud(:,3),'b.');title('Point Cloud before noisy match removal');
xlabel('X'), ylabel('Y'), zlabel('Depth (Z) in mm')

% Eliminate noisy points
meanmean=mean(sqrt(sum(reprojErrors .^ 2, 2)))
standdev=std(sqrt(sum(reprojErrors .^ 2, 2)))
errorDists = max(sqrt(sum(reprojErrors.^2,2)),[],14);

validIdx = errorDists < meanmean+standdev;
tt1=find(Cloud(:,3)>0);
validIdx(tt1)=0;
tt2=find(abs(Cloud(:,3))>1800);
validIdx(tt2)=0;
tt3=find(abs(Cloud(:,3))<1000);
validIdx(tt3)=0;

points3D = Cloud(validIdx, :);

figure;plot3(points3D(:,1),points3D(:,2),points3D(:,3),'b.');title('Point Cloud after noisy match removal');
xlabel('X'), ylabel('Y'), zlabel('Depth (Z) in mm')

validPoints1 = matchedPoints1(validIdx, :);
validPoints2 = matchedPoints2(validIdx, :);

figure;
showMatchedFeatures(I1, I2, validPoints1,validPoints2,'montage');
title('Matched Features After Removing Noisy Matches');

% get the color of each reconstructed point
validPoints1 = round(validPoints1.Location);
numPixels = size(I1, 1) * size(I1, 2);
allColors = reshape(im2double(I1), [numPixels, 3]);
colorIdx = sub2ind([size(I1, 1), size(I1, 2)], validPoints1(:,2), ...
    validPoints1(:, 1));
color = allColors(colorIdx, :);

% add green point representing the origin
points3D(end+1,:) = [0,0,0];
color(end+1,:) = [0,1,0];

% show images
figure('units','normalized','outerposition',[0 0 .5 .5])
subplot(1,2,1);
imshowpair(I1, I2, 'montage');
title('Original Images')

% plot point cloud
hAxes = subplot(1,2,2);
showPointCloud(points3D, color, 'Parent', hAxes, ...
    'VerticalAxisDir', 'down', 'MarkerSize', 40);
xlabel('x-axis (mm)');
ylabel('y-axis (mm)');
zlabel('z-axis (mm)')
title('Reconstructed Point Cloud');

figure, scatter3(points3D(:,1),points3D(:,2),points3D(:,3),50,color,'fill')
xlabel('x-axis (mm)');ylabel('y-axis (mm)');zlabel('z-axis (mm)')
title('Final colored Reconstructed Point Cloud');

【问题讨论】:

    标签: matlab 3d camera matlab-cvst point-clouds


    【解决方案1】:

    您的代码看起来不错。问题似乎出在校准中。您获得具有 3 个系数的扭曲图像这一事实告诉我,您可能没有足够的靠近图像边缘的数据点来准确估计失真。但是,您的图像很难看到。如果您拍摄具有许多直边的场景的照片并使其不失真,您会得到更好的主意。

    因此,我建议您使用尽可能靠近图像边缘的棋盘格拍摄更多图像。看看有没有帮助。

    另一件事是估计误差。在 R2014b 中,立体相机校准器应用程序可以选择返回每个估计参数的标准误差值。这些可以为您提供置信区间并告诉您是否需要更多数据点。请参阅此示例。

    哦,还要确保您的校准图像未保存为 jpeg。请使用无损格式,如 tiff 或 png。

    【讨论】:

      猜你喜欢
      • 2014-01-18
      • 1970-01-01
      • 2019-09-28
      • 1970-01-01
      • 1970-01-01
      • 2015-01-23
      • 1970-01-01
      • 2015-12-10
      • 1970-01-01
      相关资源
      最近更新 更多