Indonesian Journal of Electrical Engineering and Computer Science Vol. 15, No. 1, July 2019, pp. 511~516 ISSN: 2502-4752, DOI: 10.11591/ijeecs.v15.i1.pp511-516 511 Journal homepage: http://iaescore.com/journals/index.php/ijeecs Automatic moving foreground extraction using random walks Idir Boulfrifi, Khalid Housni, Abdelaziz Mouloudi Ibn Tofail University/Faculty of Science, Morocco Article Info ABSTRACT Article history: Received Dec 18, 2018 Revised Jan 21, 2019 Accepted Mar 4, 2019 In this paper, we propose a method for automatic foreground extraction in video frames by analyzing the spatiotemporal aspect. We divide our contribution to tree steps: Automatic seeds detection, formulating the energy function, and using the random walk algorithm to minimize this function. First, we detect seeds by extracting a sparse of good features to track in the current frame and compute the difference between those pixels and its adjacent in the previous frame, the difference of pixels is treated in HSV color space to make the result more accurate, we thresholds this difference, and we classify moving and stationary pixels. Secondly, we formulate our foreground extraction as a graph based problem, then we define an energy function to evaluate spatiotemporal smoothness. Finally, we applied the random walk algorithm with seeds detected in the first step to minimize the energy function problem, the solution leads to evaluate the potential that every pixel in the video sequences is marked in motion or a stationary pixel. We suggest that our unsupervised method has the potential to be used for many kinds of motion detection and real-time video. Keywords: Automatic motion segmentation Energy function Graph Random walk algorithm Copyright © 2019 Institute of Advanced Engineering and Science. All rights reserved. Corresponding Author: Idir Boulfrifi, Faculty of Science, Ibn Tofail University, Kenitra, Morocco. Email: iboulfrifi@gmail.com 1. INTRODUCTION Video foreground extraction aims to classify pixels of video frames to pixels belongs to the foreground and background pixels, more generally the most existed approaches are based on optical flow, background subtraction, images difference, graph based approach, clustering algorithm, and deep learning. It’s can be used in semantic scene understanding, traffic surveillance, recognition, robotic, video indexing, and many other reel-time application. A lot of research has been focused on motion detection. They can be classified into supervised [1-3] and unsupervised methods [4-11]. In the first category, the segmentation requires some initial seeds to be selected in the first frame to perform segmentation. Therefore Fan and al. [1] use a mask transfer and interpolation method, from foreground mask in source frame he estimates the foreground at an other frame. Wang and al. [3] propose an algorithm to segment video based on a level set framework and an appearance model, this algorithm requires only a single finger touch the object in the first frame. In [17] Rother and al. use iterated graph cut to extract the foreground. The second category doesn’t require any user involvement, over the pa st decade a lot of works are focused on analyzing information like coherence, motion, and appearance in space-time blob of video [5], [14], [8]. Wu and al. [15] propose a method that uses least squares tracking framework and learned appearance models to segment and track motion. Therefore Khoreva and al. [16] apply a method to learn the graph by exploiting edge topology and weights of the graph. Faktor and al. [4] use re-occurring regions by constructing a graph of the voting scheme of re-occurring regions across the video sequence. Vertens and al. [11] are used the convolutional neural network to predict the object label and motion status of each pixel in an image. This category takes on its importance in real time application requiring an instantaneous understanding of the scene. Motion segmentation still encounters many challenges like occlusion, camera