RANSAC用仿射变换+ matlab

时间:2015-05-17 15:48:27

标签: matlab image-stitching ransac

我需要在matlab中实现RANSAC算法用于图像拼接目的。     我在bestMatches矩阵中有两个图像的最佳匹配点(2 x 500)     现在我需要实现RANSAC,这是我到目前为止所做的。我已经就需要做什么发表评论,任何人都可以帮我实现整体。我已经很努力地做了几天,但没有成功。请帮忙。

% ---- run RANSAC  ----
% define RANSAC parameters
threshDistBetPoints = 0.1;
numOfIteration = 50;
numOfRandomPoints = 3;
inlierRatio = 0.6;

% output parameters of RANSAC
best_transform = [];
best_num_inliers = 0;

% Plot the data points
for i=1:numOfIteration
%    1) select 3 random points
        idx = randperm(size(bestMatches,2),numOfRandomPoints); 
        sample = bestMatches(:,idx); 

%    2) compute affine transform T'

%    3) take all 500 matching points
        % map all Q(right image) to P'(left image) (transformation)
        % Compute distances between P' and P point (Left Image) 
        % compute no. of inliers
%    4) store the currently best affine transform
        % output of first iteration - T' and no. of inliers     
        if inlierNum >= best_num_inliers 
             best_num_inliers =  inlierNum
        if end
for end
% End of algorithm best transform = T' with largest numbers of inliers
% stitch function - already implemented

Additional information 
sample =

        3677        6527        2759
        3413        6343        2485

0 个答案:

没有答案