In this work we present the class of matrix resemblance functions, i.e., functions that measure the difference between two matrices. We present two construction methods and study the properties that matrix resemblance functions satisfy, which suggest that this class of functions is an appropriate tool for comparing images. Hence, we present a comparison method for grayscale images whose result is a new image, which enables to locate the areas where both images are equally similar or dissimilar. Additionally, we propose some applications in which this comparison method can be used, such as defect detection in industrial manufacturing processes and video motion detection and object tracking.