When modeling the background with kernel density estimation, the selection of a proper kernel bandwidth becomes a critical issue. It is not easy, however, to perform pixel-wise kernel bandwidth estimation when the data associated with each pixel is insufficient. In this paper, we present a new method using spatial information to estimate the pixel-wise kernel bandwidth. The number of pixels in a spatial region is large enough to capture the variance of the underlying distribution on which the optimal kernel bandwidth is estimated. To show the effectiveness of the estimated kernel bandwidth, the background subtraction using this bandwidth is applied to OLED defect detection and its result is compared to those using the bandwidths obtained from other approaches.