With the aim of overcoming the disadvantage of background subtraction, a moving objects detection algorithm based on background and consecutive frames subtraction was presented. At first, initial background was extracted by making full use of statistical properties of pixels block-based. Then, with the combining of background and multiply consecutive frames subtraction, moving objects were detected correctly, and background needed to be updated real-time in order to adapt to environment changes. Furthermore, the normalized cross-correlation coefficient and shadow detection based on HSV space were used to eliminate rapid lighting changes and shadow. Experimental results show that the proposed algorithm has simple model and robustly adapted to lighting changes. Especially, it can effectively prevent shadow and large numbers of false detection which is produced by rapid lighting changes, and obtain the integrated foreground objects.