Identifying the moving foreground object in dynamic scenes and making the analysis of video sequences accurate and powerful is an important process for video surveillance systems. Environmental factors such as environmental noises and sudden light changes are the main factors of the degradation of the background model. Complex algorithms are needed to create a strong background against these factors. In this study, We increased the noise immunity of the background model exposed to environmental noise by applying Markov random field (MRF) to block-based modified KDE (Kernel Density Estimation). We also reduced the storage space requirement with the KDE structure we created in blocks. Thus we have increased the applicability of this structure to a real-time structure.