Template Matching in pattern recognition