Moving target detection is a significant research content of image processing and computer vision. Precise detection of moving target is the basic of target positioning, target tracking and target classification. There are many applications of it in intelligent monitoring, traffic statistics and many other fields. How to detect the moving object in a bad weather, for example, a heavy foggy day, is a problem that needs be solved in the engineering, we all know that the haze has been a quite serious environment problem in our life! The paper is based on this. First, getting rid of fog in the video, and then, extracting the features of pixels, establishing features dictionaries, building models for background by features matching in order to extract foreground. The result shows that the proposed algorithm can detect the moving target accurately in a foggy day.