In image analysis there has been an increasing interest in development and application of similarity measures for nonbinary digital images. Such measures are very useful for database querying. The problem of image-based query for retrieving grey scale images from image data bases is studied and a new low-level measure to match the query image to the data base is proposed. The measure is based on calculating distances from every pixel of the queried image to retrieved image and vice versa. These distances reflect so-called local similarity of two images. After that the local distances are accumulated into one number which can be used as a matching measure. The initial experimental results show that the proposed measure is not very sensitive to small deformations (like shift, rotation, lightness change) of both digital images and some objects presented in the images. The measure better estimate image matching than widely used correlation functions and the Hausdorff metric.