1. A pattern processing apparatus for comparing an input pattern and a registered pattern in respective local areas, thereby determining a class to which the input pattern belongs, the pattern processing apparatus comprising: a memory; and a processor in communication with the memory, the processor configured to provide; a local area setting unit configured to set the local areas in the input pattern and the registered pattern; a varied local area generating unit configured to generate a plurality of varied local area patterns based on the local area set in at least one of the input pattern and the registered pattern; a similarity calculating unit configured to calculate a plurality of similarities for combinations of a pattern of the local area set in the input pattern or the plurality of varied local area patterns generated based on the input-pattern local area and a pattern of the local area set in the registered pattern or the plurality of varied local area patterns generated based on the registered-pattern local area, the local area in the registered pattern corresponding to the local area in the input pattern; a representative similarity calculating unit configured to calculate, per local area, representative similarity in terms of similarity of the local area set in the registered pattern with respect to the local area in the input pattern from among the plurality of similarities for the combinations of the pattern of the local area set in the input pattern or the plurality of varied local area patterns generated based on the input-pattern local area and the pattern of the local area set in the registered pattern or the plurality of varied local area patterns generated based on the registered-pattern local area; and a classifying unit configured to classify, based on the representative similarity calculated by the representative similarity calculating unit, a class to which the input pattern belongs.