The target detection can be carried out with a statistical matched filter. The construction of the matched filter needs the information on the background clutter statistics as well as on the shape of the target. In military IR search and tracker systems, the intensity of the target is usually assumed to have the 2D Gaussian shape. This Gaussian assumption is valid only for a head-on approaching missile in the far distance. More often than not, however, the homing enemy missile takes the 'lead angle' trajectory, and the IR target shape may be an ellipse with a time-varying eccentricity. In such a case, the matched filter tuned to the Gaussian-shaped target either fails to detect the target, or result in a high false alarm rate. To overcome this difficulty, we propose a new extended-target detection algorithm which can adapt to the time-varying target shapes. We estimate the attitude of the target using an extended Kalman filter from a sequence of image frames. The estimated target attitude is, then used to predict the projected shape of the target image. Using the predicted target shape, we can construct a better-tuned matched filter for the detection of the target in the next image frame. The proposed algorithm has been tested with 8-12 micrometers IR image frames, and we observe that the false alarm rate has ben reduced by the order of magnitude in comparison with the simple method filtering method with the Gaussian-shaped target assumption.