Embodiments of the invention provide a method for setting a light source
parameter in order to recognize an identification mark on an object
surface. In one embodiment, a grayscale image is generated by setting the
light volume of the light source to a given value. Plural thresholds each
for binarizing the grayscale image in density are set. The inter-class
variance values to be produced respectively according to the thresholds
are calculated and the largest inter-class variance value is selected as
the peak inter-class variance value from the inter-class variance values
calculated. The light volume is changed to a plurality of different
values. Peak inter-class variance values are obtained respectively for
the values and the largest peak inter-class variance value is selected as
the maximum inter-class variance value from the peak inter-class variance
values obtained. The object surface is irradiated by the light source
whose light volume is set to a value which would give the maximum
inter-class variance value.