sorting pattern resources and fixing psnr metric
fixed scale factor for template match