1. A method of generating image data for the automatic recognition of marks on metallic and other specular surfaces which have varying conditions of surface roughness and reflectivity comprising the steps of: producing marks on such a surface of an object that have random fluctuations of height and good light scattering properties as compared to background regions; scanning the marked surface with an optical system that applies light approximately normal to the surface and limits the light sensed by an optical detector array to that reflected normal to the surface and within a predetermined solid acceptance angle, each detector generating an electrical signal corresponding to light intensity; and preprocessing said detector signals to yield high contrast image data in which background signal levels are relatively flat and significantly different than mark signal levels; wherein said detector signal are each preprocessed by developing a histogram of light intensities, determining whether the histogram is bimodal of unimodal, selecting a background light value between histogram peaks when the histogram is bimodal and a threshold background light value at the edge of the histogram when the histogram is unimodal, and thresholding said detector signal with the background value to thereby produce image data in which the background level is set to a constant.