Real-time foreground object extraction is an important subject for computer vision applications. Model-based background subtraction methods have been used to extract the foreground objects. Different from previous methods, this paper introduces a hybrid codebook-based background subtraction method by combining the mixture of Gaussian (MOG) with the codebook (CB) method. We propose an ellipsoid CB model for modeling the dynamic background with highlight and shadow, and develop a modified shadow/ highlight removal method to overcome the influence of illumination change. Our method can avoid extracting the false foreground pixels (e.g., dark background) or missing the real foreground pixels (e.g., bright foreground). Finally, we have done two experiments to compare the performance of our method with the others based on [18] and the change detection benchmark dataset provided in CVPR 2011, respectively.