This paper introduces a new distance metric function to enhance the capability of the Dynamic Time Warping (DTW) for two dimension pattern matching. Moreover, the classical boundary condition is relaxed to further improve the performance of the DTW. An efficient approach for constructing the warping path is presented to reduce computational execution time in detecting eye and face regions in head–shoulder images with plain background. The performance of the enhanced DTW is compared against that of the classical DTW in detecting the faces and eyes of 15 subjects with various poses and facial expressions. The experimental results indicate that improvement in the detection rates of both eyes and faces is achieved using the enhanced DTW.