Indonesian Journal of Electrical Engineering and Computer Science Vol. 15, No. 1, July 2019, pp. 517~526 ISSN: 2502-4752, DOI: 10.11591/ijeecs.v15.i1.pp517-526 517 Journal homepage: http://iaescore.com/journals/index.php/ijeecs Automatic foreground detection based on KDE and binary classification Mohammed Lahraichi, Khalid Housni, Samir Mbarki MISC Laboratory, Ibn Tofail University, Faculty of Sciences Kenitra, Morocco Article Info ABSTRACT Article history: Received Nov 21, 2018 Revised Jan 21, 2019 Accepted Feb 28, 2019 In the recent decades, several methods have been developed to extract moving objects in the presence of dynamic background. However, most of them use a global threshold, and ignore the correlation between neighboring pixels. To address these issues, this paper presents a new approach to generate a probability image based on Kernel Density Estimation (KDE) method, and then apply the Maximum A Posteriori in the Markov Random Field (MAP-MRF) based on probability image, so as to generate an energy function, this function will be minimized by the binary graph cut algorithm to detect the moving pixels instead of applying a thresholding step. The proposed method was tested on various video sequences, and the obtained results showed its effectiveness in presence of a dynamic scene, compared to other background subtraction models. Keywords: Energy function Graph cut Moving object detection kernel density estimation Copyright © 2019 Institute of Advanced Engineering and Science. All rights reserved. Corresponding Author: Mohammed Lahraichi, MISC Laboratory, Faculty of Sciences, Ibn Tofail University, Kenitra, Morocc. Email: lahraichi.mohamed@gmail.com 1. INTRODUCTION The separation of moving pixels from their background is an essential phase in many computer vision fields, especially, in video surveillance, traffic monitoring, activity recognition, etc. The main idea is to create a statistical model of the background, aiming to generate a representation of a background image based on previous frames by using density functions [1], either on each pixel or by regions. Then, this representation is compared against the input frame to get a binary mask image which represents the position of the moving objects. Yet, the background is not always static in general, so the model must be robust and more adaptive for the purpose to overcome some frequent issues successfully, such as gradual or sudden illumination change, non stationary background [2]. Different background modeling techniques have been proposed to address the previous limitations [2]. The tradictional ones are based on pixel intensity, which exploit only the intensity value to decide if a pixel belongs to the background or the moving objects. Despite their promising performances, they generate some misclassified pixels, especially if the background and the foreground have the same color, and because they also ignore the spatial dependencies of neighboring pixels. While, models based on texture features [3] have demonstrated a certain degree of success in exploiting the spatial correlation, they consider discriminative texture measure as features to distinguish moving pixels from the background. Although, they still have some shortcomings like the use of a threshold to detect the moving pixels. Recently, several methods based on deep learning have appeared [4]. Which aim at handling all above limitations, However, they require a training phase with several annotated examples, that needs more computational time. In order to tackle some of these issues, firstly, we generate a probability image using KDE method, and then, instead of using a threshold to segment this image into foreground and background, this binary