Image matching is a critical issue in many image processing applications. It is very likely that the real-time sensed image and the reference image have significant differences in terms of brightness, contrast, and angle due to the changing parameters of imaging devices, the illumination conditions, and the view angles. This has greatly affected the precision and the efficiency of the target recognition tasks in remote sensing. We construct a novel moment invariant as a confidence measure for the image matching task. Using the distance between template and local region in a real-time image in the feature space of moment invariant, a target detection algorithm is implemented that does not rely on either the imaging angles or the illumination conditions. Based on the phases of complex moments, the direction of each matching region in relation to the template can also be obtained. The experiments show that the algorithm can be used in target identification with changing conditions of the brightness, contrast, and the rotation angles in relation to the template.