Automatic target detection is a research focus in hyperspectral image processing field. Algorithms such as the matched filter (MF) and the adaptive coherence/cosine estimator (ACE) directly use the prior knowledge of target spectral signatures to detect targets. In this paper, we propose a difference measured function based matched filter (DFMF), which could include the famous algorithm MF as a special case. The DFMF uses a new measured function to build an objective function, and utilizes the gradient descent method to find an optimal projection vector. After finding the optimal projection vector, the interesting targets can be detected in the projection space. The experimental results demonstrate the proposed algorithm could detect interesting targets effectively and performs better than some other experimental algorithms.