A template matching approach is used to demosaic (reconstruct) a full color image from the sparse pixel data captured by a CMOS imager. The proposed method is based on the Nevatia-Babu template-based linear feature extraction algorithm. This approach provides the color accuracy of gradient based algorithms yet reaps the benefit of regularity of processing of bilinear interpolation. In this paper we describe the algorithm (gradient estimation and color interpolation), compare results to other approaches, and present a hardware implementation. The consideration of hardware implementation is especially important as CMOS imagers find their way into low cost devices such as cell phones and other novelty camera applications.© (2007) COPYRIGHT SPIE--The International Society for Optical Engineering. Downloading of the abstract is permitted for personal use only.