Moving Object Detection Software: SC-SOBS

This page has been created in order to distribute a prototype software implementing the Spatially Coherent Self-Organizing Background Subtraction (SC-SOBS) algorithm presented in

L. Maddalena, A. Petrosino, The SOBS Algorithm: What Are the Limits?, IEEE Workshop on Change Detection, at CVPR 2012

If you use the software, please cite the above mentioned paper.

Click here to download the Windows executable (WinZip compressed) together with the needed OpenCV .dll's. Basic usage for Change Detection Competition: Unzip the SC-SOBS.exe and the .dll's into the directory holding the “dataset” directory containing the Change Detection Challenge sequences [1]. To obtain all masks for the “baseline/highway” sequence, just type:

SC-SOBS dataset/baseline/highway/input/in

Click here to download the masks computed by SC-SOBS for the whole dataset. Usage with generic image sequences:

SC-SOBS <SeqName> <#FirstFrame> <#LastFrame> [Parameters]


  • <SeqName>: sequence name (complete path), not including frame numbers. Image sequences consist of binary .jpg image frames with consecutive 6 digit numbers, named in the following form <SeqName><number>.jpg

  • <#FirstFrame>: number of first sequence frame to be considered. Default: 1

  • <#LastFrame>: number of last sequence frame to be considered. Default: toIdx (toIdx read from file ‘temporalROI.txt’ as in [1])

  • [parameters]: optional, including:

    • -n #: (square root of) number of weight vectors for each pixel. Default: 3

    • -K #: Number of initial frames for training. Default: fromIdx-1 (fromIdx read from file ‘temporalROI.txt’ as in [1])

    • -e1 #: Distance threshold e1 for training phase (Eq. (12)). Default: 1.0

    • -e2 #: Distance threshold e2 for testing phase (Eq. (2)). Default: 0.008

    • -c1 #: Learning rate c1 for training phase (Eq. (14)). Default: 1.0

    • -c2 #: Learning rate c2 for testing phase (Eq. (14)). Default: 0.05

    • -Cw #: Size of the neighbourhood for Spatial Coherence (Eq. (10)). Default: 5

    • -s #: To apply shadow removal (as in [2]). Default: 1 (apply)

    • -g #: Shadow detection value for g in eqn. (5) in [2]. Default: 0.7

    • -b #: Shadow detection value for b in eqn. (5) in [2]. Default: 1.0

    • -tS #: Shadow detection value for tS in eqn. (5) in [2]. Default: 0.1

    • -tH #: Shadow detection value for tH in eqn. (5) in [2]. Default: 10.0

    • -ROI #: To use ROI.bmp mask as in [1]. Default: 1 (do use)

    • -Med #: Size of the neighbourhood for Median Filtering Post-Processing. Default: 0 (no Post-Processing)

    • -m #: To save background model images. Default: 0 (do not save; only models for frames K-1 and #LastFrame are saved)

    • -l #: To save only last detection mask. Default 0 (save all in the temporal ROI)

Examples of use with generic image sequences:

  1. SC-SOBS

Provides the above information on usage.

  1. SC-SOBS c:/Sequences/WavingTrees/WavingTrees 1000 1247 -K 200 -e1 0.1 -e2 0.03 -c1 1.0 -c2 0.05 –l 1 –ROI 0

where sequence WavingTrees, coming from sequences adopted in K. Toyama, J. Krumm, B. Brumitt, and B. Meyers, “Wallflower: principles and practice of background maintenance,” in Proc. 7th IEEE Conf. Computer Vision, 1999, vol. 1, pp. 255–261, has been saved in binary .jpg image files named:
WavingTrees001000.jpg, …, WavingTrees001247.jpg

and stored in directory c:/Sequences/WavingTrees. This gives the moving object detection mask for last frame (named bin001247.png) as well the background model (named Model001199.ppm) achieved by training on the first 200 frames and the updated background model (named Model001247.ppm) for the last frame.
3) SC-SOBS c:/Sequences/WavingTrees/WavingTrees 1000 1247 -K 200 -e1 0.1 -e2 0.03 -c1 1.0 -c2 0.05 –l 1 –ROI 0 –Med 3

same as before, but applying median filtering post-processing in a 3x3 neighbourhood to masks (through OpenCV function cvSmooth).