资源描述:
《基于ICP算法的图像配准的MATLAB实现.docx》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、function[TR,TT]=icp(model,data,max_iter,min_iter,fitting,thres,init_flag,tes_flag,refpnt)%ICPIterativeClosestPointAlgorithm.Takesuseof%Delaunaytesselationofpointsinmodel.%%Ordinaryusage:%%[R,T]=icp(model,data)%%ICPfitpointsindatatothepointsinmodel.%Fitwithrespectt
2、ominimizethesumofsquare%errorswiththeclosestmodelpointsanddatapoints.%%INPUT:%%model-matrixwithmodelpoints,[Pm_1Pm_2...Pm_nmod]%data-matrixwithdatapoints,[Pd_1Pd_2...Pd_ndat]%%OUTPUT:%%R-rotationmatrixand%T-translationvectoraccordinglyso%%newdata=R*data+T.%%newdat
3、aaretransformeddatapointstofitmodel%%%Specialusage:%%icp(model)oricp(model,tes_flag)%%ICPcreatesaDelaunaytessellationofpointsin%modelandsaveitasglobalvariableTes.ICPalso%savestwoglobalvariablesirandjcfortes_flag=1(default)or%TesindandTesverfortes_flag=2,which%make
4、siteasytofindinthetesselation.Tousetheglobalvariables%inicp,puttes_flagto0.%%%Otherusage:%%[R,T]=icp(model,data,max_iter,min_iter,...%fitting,thres,init_flag,tes_flag)%%INPUT:%%max_iter-maximumnumberofiterations.Default=104%%min_iter-minimumnumberofiterations.Defa
5、ult=4%%fitting-=2Fitwithrespecttominimizethesumofsquareerrors.(default)%alt.=[2,w],wherewisaweightvectorcorrespondingtodata.%wisavectorofsamelengthasdata.%Fitwithrespecttominimizetheweightedsumofsquareerrors.%=3Fitwithrespecttominimizethesumtotheamount0.95%ofthecl
6、osestsquareerrors.%alt.=[3,lambda],0.07、nd%rotationineachiteration.%%thres-errordifferensthresholdforstopiterations.Default1e-5%%init_flag-=0noinitialstartingtransformation%=1transformdatasothemeanvalueof%dataisequaltomeanvalueofmodel.%Norotation.(init_flag=1default)%%tes_flag-=0Nonewtesselationhastobed
8、one.There%alredyexistsoneforthecurrentmodelpoints.%=1Anewtesselationofthemodelpointswill%bedone.(default)%=2Anewtesselationofthemodelpointswill%bedone.A