Calculate min distance for transformed points dmin = vb_calc_fitting(para, V0, Vref, parm) --- Input para : [ dX ; th ] rigid body transformation parameter (6x1 vector) dX : Translation parameter of 3 directions (3x1 vector) th : Rotation angle around x, y, z axis [radian] (3x1 vector) V0 : transformed point set Vref : reference points parm : parameters .Rmax = first search radius .Npos = # of head points .pos_rate = distance weight for head points vs face points --- Output dmin = Min distance from rigid-transformed 'V0' to reference point set 'Vref' Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function dmin = vb_calc_fitting(para, V0, Vref, parm) 0002 % Calculate min distance for transformed points 0003 % 0004 % dmin = vb_calc_fitting(para, V0, Vref, parm) 0005 % --- Input 0006 % para : [ dX ; th ] rigid body transformation parameter (6x1 vector) 0007 % dX : Translation parameter of 3 directions (3x1 vector) 0008 % th : Rotation angle around x, y, z axis [radian] (3x1 vector) 0009 % V0 : transformed point set 0010 % Vref : reference points 0011 % parm : parameters 0012 % .Rmax = first search radius 0013 % .Npos = # of head points 0014 % .pos_rate = distance weight for head points vs face points 0015 % --- Output 0016 % dmin = Min distance from rigid-transformed 'V0' to reference point set 'Vref' 0017 % 0018 % Copyright (C) 2011, ATR All Rights Reserved. 0019 % License : New BSD License(see VBMEG_LICENSE.txt) 0020 0021 Npoint = size(V0,1); 0022 Npos = parm.Npos; 0023 0024 if Npos == 0 | Npos == Npoint 0025 dmin = vb_distance_min3d( Vref, vb_rigid_transform(V0, para) , parm.Rmax ); 0026 else 0027 dmin1 = vb_distance_min3d( Vref, ... 0028 vb_rigid_transform(V0(1:Npos,:), para) , parm.Rmax ); 0029 dmin2 = vb_distance_min3d( Vref, ... 0030 vb_rigid_transform(V0(Npos+1:end,:), para) , parm.Rmax ); 0031 0032 dmin = parm.pos_rate * dmin1 + parm.scan_rate * dmin2; 0033 end 0034 0035 pause(1/1000); % pause(sec): The chance to cancel is given to MATLAB.