For the problems that moving target detection is affected by the background and inter-frame difference is easy to produce hollow. An improved algorithm is proposed for moving target detection. It is based on modular improved three frame difference with background difference. The initial background is established by edge detection and averaging method, then the video images are divided into multiple sub-block, detecting the video images sub-blocks which achieved in the use of improved three frame difference and background difference with adaptive threshold. To obtain the moving target in the image, the background image is updated by self-adaptive method. The experimental results show that the algorithm can extract the moving object completely, has high accuracy and efficiency, and the background has strong adaptability.