Template learning using wavelet domain statistical models