Abstract:When counting papers and wafer cells, the sides of gathered images are horizontally striped. During its filtering, traditional filtering algorithm often results edge image blur. To solve those problems, this paper presents an adaptive template filtering algorithm for vertical solar cells image, which determines threshold by the image gray, finds edge pixels to exclude, and creates the template for the rest of the pixels by surrounding pixels’ gray value. It is seen from the graph of the gradation values before and after filtering that the algorithm has good effect at the edges, and the gray of result image is highly smoothed, and the algorithm has practical value.