| Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) | 
![]()  | 
	
| 
	 | 
| 		
			
			 | 
		#1 | 
| 
			
			 初级会员 
			
			
			
			注册日期: 2009-04-15 
				
				年龄: 38 
				
					帖子: 2
				 
				
				
				声望力: 0 ![]()  | 
	
	
	
		
		
			
			 
			
			各位大侠,本人要做一个三维轮廓测量系统的数据融合,在网上下载到了数据融合的ICP算法的源代码,但是不知道输入变量和输出变量是什么,哪位大侠能帮我看看,我只是想知道输入的变量是怎样的格式。。。 
		
		
		
		
		
		
		
	以下是代码,前面有这个函数的说明,我用坐标的矩阵输入,可输出不对 谢谢各位大侠!!! 代码: 
	function [TR, TT] = icp(model,data,max_iter,min_iter,fitting,thres,init_flag,tes_flag,refpnt)
% ICP Iterative Closest Point Algorithm. Takes use of
% Delaunay tesselation of points in model.
%
%   Ordinary usage:
%
%   [R, T] = icp(model,data)
%
%   ICP fit points in data to the points in model.
%   Fit with respect to minimize the sum of square
%   errors with the closest model points and data points.
%
%   INPUT:
%
%   model - matrix with model points, [Pm_1 Pm_2 ... Pm_nmod]
%   data - matrix with data points,   [Pd_1 Pd_2 ... Pd_ndat]
%
%   OUTPUT:
%
%   R - rotation matrix and
%   T - translation vector accordingly so
%
%           newdata = R*data + T .
%
%   newdata are transformed data points to fit model
%
%
%   Special usage:
%
%   icp(model)  or icp(model,tes_flag)
%
%   ICP creates a Delaunay tessellation of points in
%   model and save it as global variable Tes. ICP also
%   saves two global variables ir and jc for tes_flag=1 (default) or
%   Tesind and Tesver for tes_flag=2, which
%   makes it easy to find in the tesselation. To use the global variables
%   in icp, put tes_flag to 0.
%
%
%   Other usage:
%
%   [R, T] = icp(model,data,max_iter,min_iter,...
%                         fitting,thres,init_flag,tes_flag)
%
%   INPUT:
%
% 	max_iter - maximum number of iterations. Default=104
%
% 	min_iter - minimum number of iterations. Default=4
%
%   fitting  -  =2 Fit with respect to minimize the sum of square errors. (default)
%                  alt. =[2,w], where w is a weight vector corresponding to data.
%                  w is a vector of same length as data.
%                  Fit with respect to minimize the weighted sum of square errors.
%               =3 Fit with respect to minimize the sum to the amount 0.95
%                  of the closest square errors.
%                  alt. =[3,lambda], 0.0<lambda<=1.0, (lambda=0.95 default)
%                  In each iteration only the amount lambda of the closest
%                  points will affect the translation and rotation.
%                  If 1<lambda<=size(data,2), lambda integer, only the number lambda
%                  of the closest points will affect the translation and
%                  rotation in each iteration.
%
% 	thres - error differens threshold for stop iterations. Default 1e-5
%
% 	init_flag  -  =0 no initial starting transformation
%                 =1 transform data so the mean value of
%                     data is equal to mean value of model.
%                     No rotation. (init_flag=1 default)
%
% 	tes_flag  -  =0 No new tesselation has to be done. There
%                   alredy exists one for the current model points.
%                =1 A new tesselation of the model points will
%                   be done. (default)
%                =2 A new tesselation of the model points will
%                   be done. Another search strategy than tes_flag=1
%                =3 The closest point will be find by testing
%                   all combinations. No Delaunay tesselation will be done.
%
%   refpnt - (optional) (An empty vector is default.) refpnt is a point corresponding to the
%                 set of model points wich correspondig data point has to be find.
%                 How the points are weighted depends on the output from the
%                 function weightfcn found in the end of this m-file. The input in weightfcn is the
%                 distance between the closest model point and refpnt.
%
%   To clear old global tesselation variables run: "clear global Tes ir jc" (tes_flag=1)
%   or run: "clear global Tes Tesind Tesver" (tes_flag=2) in Command Window.
%
%   m-file can be downloaded for free at
%   http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=12627&objectType=FILE
%
%   icp version 1.4
%
%   written by Per Bergstr鰉 2007-03-07
if nargin<1
    error('To few input arguments!');
elseif or(nargin==1,nargin==2)
    bol=1;
    refpnt=[];
    if nargin==2
        if isempty(data)
            tes_flag=1;
        elseif isscalar(data)
。。。。后面的太长了,省略
 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 		
			
			 | 
		#2 | 
| 
			
			 初级会员 
			
			
			
			注册日期: 2009-04-15 
				
				年龄: 38 
				
					帖子: 2
				 
				
				
				声望力: 0 ![]()  | 
	
	
	
		
		
			
			 
			
			PS:只要知道其中的前两个输入量的格式就好了,其它的都有默认值,谢谢了。。。
		 
		
		
		
		
		
		
		
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 		
			
			 | 
		#3 | 
| 
			
			 初级会员 
			
			
			
			注册日期: 2009-04-15 
				
				年龄: 39 
				
					帖子: 14
				 
				
				
				声望力: 17 ![]()  | 
	
	
	
		
		
			
			 
			
			上面不是有写吗 
		
		
		
		
		
		
		
	model - matrix with model points, [Pm_1 Pm_2 ... Pm_nmod] data - matrix with data points, [Pd_1 Pd_2 ... Pd_ndat]  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 		
			
			 | 
		#4 | 
| 
			
			 高级会员 
			
			
			
			注册日期: 2008-11-01 
				
				年龄: 39 
				
					帖子: 406
				 
				
				
				声望力: 27 ![]()  | 
	
	
	
		
		
			
			 
			
			lz ICP方法的含义你应当了解吧 寻找两个存在一定旋转关系的模型之间 
		
		
		
		
		
		
		
	model和data分别是两个模型对应的点集 可以参考wiki的解释 http://en.wikipedia.org/wiki/Iterative_Closest_Point Thx for reading. PS:若还算满意,直接点击“Thanks”,再次登陆时亦便于查看回答是否真的帮到你了。 个人观点 仅供参考 多多交流 相互学习  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 |