In view of the traditional three frame difference method in the foreground extraction is easy to appear "hollow" phenomenon, make improvement on the traditional three frame difference method,use the logical "or" instead of the original logic "and", but at the same time produce a moving target is elongated and contour blurring problem. In order to effectively solve the problem,combined the sliding average background method with improved three frame difference,however in the initial phase the sliding average background to update the background is slow,therefore the key of effective combination of the two method is to improve the sliding average method,puts forward an adaptive update moving average coefficient of acceleration background updating method. Finally improved three frame difference extracted foreground and the foreground of improved sliding average method to logic "and" to get comprehensive foreground image. Experimental results show that the algorithm can quickly and completely and accurately detect moving targets and meet the needs of real-time detection.