Can we speed things up?
     
   
T = total number of frames, N = final number of exemplars
   
Computational cost: O(T*N)
   
Two level recursion, branching factor B = sqrt(N)
   
First pass cost: O( T * B )
   
Second pass cost per group: O( T/B * B) = O( T )
   
Total second pass cost: O( B * T )
   
Total cost reduction factor: B/2 = sqrt(N)/2