• 大小: 5KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-12
  • 语言: 其他
  • 标签: Ransac算法  

资源简介

通过Ransac算法剔除噪声点,用最小二乘法拟合直线和不剔除噪声点拟合直线之间的比较。

资源截图

代码片段和文件信息

%%How many outside points fit the model judging by the distance from the point to the line%%
%Consensus_Setx     The original x Bureau points
%Consensus_Sety     The original y Bureau points
%Maybe_outliersx    The x Outlier
%Maybe_outliersy    The y Outlier
%line_vec           Linear coefficient
%point_line_dis     Point-to-line distance threshold
function [Re_Consensus_Set2dRe_Consensus_Set3d] = AgreeWithModel(Consensus_SetxConsensus_SetyMaybe_outliersxMaybe_outliersyline_vecpoint_line_dis)
Consensus_Set_temx = Consensus_Setx;                %Temporary variables are saved
Consensus_Set_temy = Consensus_Sety;
[mn] = size(Maybe_outliersx);
for i=1:m
    distem = abs(line_vec(11)*Maybe_outliersx(i1)+line_vec(12)-Maybe_outliersy(i1))/sqrt(line_vec(11)^2+1);%Judge the distance from the point to the line
    if (distem < point_line_dis)
        Consensus_Set_temx = [Consensus_Set_temx;Maybe_outliersx(i1)];
        Consensus_Set_temy = [Consensus_Set_temy;Maybe_outliersy(i1)];
    end
end
Re_Consensus_Set2d = Consensus_Set_temx;
Re_Consensus_Set3d = Consensus_Set_temy;

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-02-28 22:49  Ransac_ls\
     文件        1254  2018-02-28 22:21  Ransac_ls\ransactest.m
     目录           0  2018-02-28 22:54  __MACOSX\
     目录           0  2018-02-28 22:54  __MACOSX\Ransac_ls\
     文件         210  2018-02-28 22:21  __MACOSX\Ransac_ls\._ransactest.m
     文件         300  2018-02-06 21:21  Ransac_ls\ls.m
     文件         266  2018-02-06 21:21  __MACOSX\Ransac_ls\._ls.m
     文件        1726  2018-02-06 23:55  Ransac_ls\RandomNData.m
     文件         120  2018-02-06 23:55  __MACOSX\Ransac_ls\._RandomNData.m
     文件         357  2018-02-06 23:44  Ransac_ls\NumInVec.m
     文件         120  2018-02-06 23:44  __MACOSX\Ransac_ls\._NumInVec.m
     文件         276  2018-02-07 00:01  Ransac_ls\ls_test.m
     文件         210  2018-02-07 00:01  __MACOSX\Ransac_ls\._ls_test.m
     文件        1116  2018-02-06 23:41  Ransac_ls\AgreeWithModel.m
     文件         120  2018-02-06 23:41  __MACOSX\Ransac_ls\._AgreeWithModel.m

评论

共有 条评论