procOPA                package:shapes                R Documentation

_O_r_d_i_n_a_r_y _P_r_o_c_r_u_s_t_e_s _a_n_a_l_y_s_i_s

_D_e_s_c_r_i_p_t_i_o_n:

     Ordinary Procustes analysis : the matching of one configuration to
       another using translation, rotation and (possibly) scale.
     Reflections  can also be included if desired. The function matches
     configuration B  onto A by least squares.

_U_s_a_g_e:

     procOPA(A, B, scale = TRUE, reflect = FALSE)

_A_r_g_u_m_e_n_t_s:

       A: k x m matrix (or complex k-vector for 2D data), of  k
          landmarks in m dimensions. This is the reference figure.

       B: k x m matrix (or complex k-vector for 2D data). This is  the
          figure which is to be transformed.

   scale: logical indicating if scaling is required

 reflect: logical indicating if reflection is allowed

_V_a_l_u_e:

     A list with components:           

       R: The estimated rotation matrix (may be an orthogonal matrix 
          if reflection is allowed)

       s: The estimated scale matrix

    Ahat: The centred configuration A

    Bhat: The Procrustes registered configuration B

     OSS: The ordinary Procrustes sum of squares, which is 
          $\|Ahat-Bhat\|^2$

_A_u_t_h_o_r(_s):

     Ian Dryden

_R_e_f_e_r_e_n_c_e_s:

     Dryden, I.L. and Mardia, K.V. (1998). Statistical shape  analysis.
     Wiley, Chichester.

_S_e_e _A_l_s_o:

     procGPA,riemdist,tpsgrid

_E_x_a_m_p_l_e_s:

     data(digit3.dat)

     A<-digit3.dat[,,1]
     B<-digit3.dat[,,2]
     ans<-procOPA(A,B) 
     plotshapes(A,B,joinline=1:13)
     plotshapes(ans$Ahat,ans$Bhat,joinline=1:13)

     #Sooty Mangabey data
     data(sooty.dat)
     A<-sooty.dat[,,1]   #juvenile
     B<-sooty.dat[,,2]   #adult
     par(mfrow=c(1,3))
     par(pty="s")
     plot(A,xlim=c(-2000,3000),ylim=c(-2000,3000),xlab=" ",ylab=" ")
     lines(A[c(1:12,1),])
     points(B)
     lines(B[c(1:12,1),],lty=2)
     title("Juvenile (-------) Adult (- - - -)")
     #match B onto A
     out<-procOPA(A,B)
     #rotation angle
     print(atan2(out$R[1,2],out$R[1,1])*180/pi)
     #scale
     print(out$s)
     plot(A,xlim=c(-2000,3000),ylim=c(-2000,3000),xlab=" ",ylab=" ")
     lines(A[c(1:12,1),])
     points(out$Bhat)
     lines(out$Bhat[c(1:12,1),],lty=2)
     title("Match adult onto juvenile")
     #match A onto B
     out<-procOPA(B,A)
     #rotation angle
     print(atan2(out$R[1,2],out$R[1,1])*180/pi)
     #scale
     print(out$s)
     plot(B,xlim=c(-2000,3000),ylim=c(-2000,3000),xlab=" ",ylab=" ")
     lines(B[c(1:12,1),],lty=2)
     points(out$Bhat)
     lines(out$Bhat[c(1:12,1),])
     title("Match juvenile onto adult")

