On the minimum number of templates required for shift, rotation and size invariant pattern recognition