In this paper, we present a novel algorithm for the automatic detection and measurement of Vickers indentation hardness, using image processing. This algorithm uses image segmentation via binarization, automatically evaluating the mean and extreme gray values by means of standard histogram equalization so as to determine the optimal binarization threshold from each input image. We use a morphological filter and region growing to identify the indentation footprint. Our algorithm determines the four indentation vertices required to calculate diagonal lengths and Vickers hardness number. This algorithm is applied to 230 indentation images of steel-316 and hafnium nitride specimens, obtained using a micro hardness machine. The proposed algorithm can measure the Vickers hardness number of specimens using their indentation images. The algorithm results have a relative error of less than 3% with respect to those obtained through a conventional manual procedure. This algorithm can be used for indentation images with low contrast and irregular indentation edges.