Based on ViBe, this paper explores a new moving object detection algorithm combining with the three frame difference method. Firstly, we build model on every pixels of the background with the advantage of ViBe; then, do the logic AND operation between two differential images which have been subtracted from the current image and the previous image; lastly, update the model in real time with the idea of ViBe. Meanwhile, in order to remove the high frequency component of the image, we add wavelet denoising to every frame of the image. This algorithm effectively overcomes the effect of illumination change on the system and eliminates the ghost as well as the blinking background pixels. Experiments confirm that this algorithm can accurately extract moving objects in multiple environments and has higher robustness.