This paper presents a unified framework for automatically detecting and tracking dim small targets in infrared (IR) image sequence under complex backgrounds. Firstly, the variance weighted information entropy (variance WIE) followed by a region growing technique is introduced to segment the candidate targets in a single-frame IR image after background suppression. Then the pipeline filter is used to verify the real targets. The position and the size of the detected target are then obtained to initialize the tracking algorithm. Secondly, we adopt an improved local binary pattern (LBP) scheme to represent the target texture feature and propose a joint gray-texture histogram method for a more distinctive and effective target representation. Finally, target tracking is accomplished by using the mean shift algorithm. Experimental results indicate that the proposed method can effectively detect the dim small targets under complex backgrounds and has better tracking performance compared with the gray histogram based tracking methods such as the mean shift and the particle filtering.