Foreground detection is a significant area of study within the realm of computer vision and plays a crucial role in video-based applications. The Vibe algorithm is an efficient foreground detection method, and this paper proposes an optimized Vibe algorithm that incorporates fused edge information to address the issues of "ghosting" and noise. Initially, the edge information derived from the three-frame method is enhanced by the Canny operator. Subsequently, the OTSU algorithm is employed to filter out additional noise in the image, thereby enhancing the robustness of the algorithm. Finally, the optimized three-frame difference method is fused with the Vibe algorithm to eliminate the "ghosting" and achieve a complete foreground target. Experimental results demonstrate that the proposed algorithm effectively removes "ghosting" and noise, providing good real-time performance and robustness, thereby meeting the application requirements of real-time detection.