A Selective Attention-Based Method for Visual Pattern Recognition with Application to Handwritten Digit Recognition and Face Rec