January 30, 2013

Implementation of background subtraction in Simulink with Creative Live! webcam

/Dropbox/MATLAB/detect_bg_subtraction
The background subtraction was implemented as a Simulink model using Level-2 MATLAB S-function block with the Creative Live! webcam. The implementation uses Image Acquisition Tolbox.
During the initialization, we compute mean image. We use mean instead of median, because unlike the median, mean can be computed iteratively without storing all the data in memory. The number of frames used for averaging can be set inside the S-function as the constant 'nsamples'. After the initialization, the algorithm is paused and we place the object to be tracked into the field of view (FOV) of the camera. To save some computing power, we only search for the object in a restricted region of interest (ROI). The position of ROI is stored and updated in every iteration of the algorithm.
Simulink model implementation of background subtraction
We have made a modification to the background subtraction algorithm described in the article Ball detection-background subtraction. We have left out the thresholding phase, as it turned out to be unnecessary.
Region of interest with estimated position of the center of the ball
The estimation of ball position is not very precise. The influence of the shade thrown by the ball on the picture above is obvious.
Screenshot from live video with estimated center of the ball marked with green cross


1 comment:

  1. please i want more details about bgsub_s_function Block
    my email
    m_awney@hotmail.com
    thanks sir

    ReplyDelete