Morphological operations are used for segmentation, feature generation, and location extraction. A recursive adaptive thresholding algorithm transforms a gray-level image into a set of multiple level regions of objects. A distance transformation algorithm then is used to transform a binary image into the minimum distance from each object point to the object's boundary. This algorithm uses a morphological erosion with a large structuring element which may correspond to Euclidean, city-block, or chessboard distance measures. For rotation-invariance and precision measurements, the Euclidean distance should be chosen. The large Euclidean structuring element can be decomposed into the maximum of recursive dilations with multiple small structuring components, which allows the easy implementation of this algorithm. A shape library database with hierarchical features is automatically generated. The features extracted are the shape number and the skeletal local-maximum points radii and coordinates. Object recognition is achieved by comparing the shape number and the hierarchical radii. Object location is detected by a hierarchical morphological bandpass filter.