Error analysis of background subtraction