【问题标题】:MATLAB estimateUncalibratedRectification non-deterministic behaviorMATLAB 估计UncalibratedRectification 非确定性行为
【发布时间】:2016-03-12 21:57:25
【问题描述】:

我已经编写了下面的函数来执行图像校正。我只使用标准 MATLAB 库函数(estimateUncalibratedRectificationestimateFundamentalMatrix)和我自己对 MATLAB 的 matchFeatures 的包装函数来执行立体声校正。然而,使用相同的输入,我每次都会得到不同的结果。我知道这与使用 RANSAC 估计基本矩阵有关。但是,整改有时很糟糕,有时还过得去。例如,我的函数在相同输入的情况下运行了 10 多次不同的结果,其中两个结果还可以,而 8 次给出了这个错误的变化:

Warning: An epipole may be located inside of an image. The epipoles
are located at [285.8503,76.1656] in I1 and [265.5734,130.3931] in I2,
but the specified imageSize was [320,568]. Severe distortion may
result if T1 or T2 are used to transform these images. See
isEpipoleInImage for more information. 
> In coder.internal.warning (line 7)
  In cvalgEstimateUncalibratedRectification (line 114)
  In estimateUncalibratedRectification (line 107)
  In pairwiseTransformation (line 48)

我相信这意味着整流无法将极点投射到无穷远。

这里发生了什么?值得注意的是,我的图像之间有 279 个假定匹配项和 32 个 inlierMatches。

我的功能:

function [t1, t2] = pairwiseTransformation(img1, img2, features1, features2)

    % Identify putative matches
    [matches1, matches2] = matchFeaturePoints(rgb2gray(img1), features1, ...
        rgb2gray(img2), features2);

    % Estimate the fundamental matrix so that matches2' * F * matches1 = 0
    % F transforms matches1 to a line that runs through the corresponding
    % point in matches1. Therefore, any rotation and translation derived from F
    % (and E) will apply to camera 2's relative position, holding camera 1 fixed.
    [F, inliers] = estimateFundamentalMatrix(matches1, matches2, 'Method', 'RANSAC', ...
        'NumTrials', 2000, 'DistanceThreshold', 1e-4);

    % Use the RANSAC inliers to determine the relative position of img2 compared to img1
    inlierMatches1 = matches1(inliers, :);
    inlierMatches2 = matches2(inliers, :);


    [t1, t2] = estimateUncalibratedRectification(F, inlierMatches1, inlierMatches2, ...
        size(img1));

    r1 = imwarp(img1, projective2d(t1), 'OutputView', imref2d(size(img1)));
    r2 = imwarp(img2, projective2d(t2), 'OutputView', imref2d(size(img1)));

    figure;
    subplot(2,2,1),imshow(img1)
    subplot(2,2,2),imshow(img2)
    subplot(2,2,3),imshow(r1)
    subplot(2,2,4),imshow(r2)
end

这是一个不错的纠正(顶行是原始图像,底部是纠正):

这是一个完全拙劣的努力,发出了极点警告:

【问题讨论】:

  • 再看,我猜这拙劣的努力是纠正,只是结果是垃圾。

标签: matlab image-processing computer-vision matlab-cvst


【解决方案1】:

32 个内部匹配项似乎太少了...您假定的匹配项看起来如何?

要尝试的一件事是调整estimateFundamentalMatrix 的参数。我会使用MSAC 而不是RANSAC,并将DistanceThreshold 增加到0.1 甚至1。同时您可能想要增加Confidence 参数,可能增加到99.99。这将迫使 RANSAC 进行更多试验,并增加您找到正确解决方案的机会。

要尝试的另一件事是从matchFeatures 获得更多更好的推定匹配。您应该尝试调整特征检测器函数的参数以获得更多特征,然后调整matchFeatures 的参数以确保匹配仍然良好。您也可以尝试不同的检测器和描述符。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-08-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-07
    • 2019-02-19
    相关资源
    最近更新 更多