Images with trails are obtained when observing space debris, no matter the telescope tracks on sidereal or target’s speed. Low astrometric accuracy of trailed sources remains one of the most essential sources of the orbital data uncertainty for space debris. The widely used point spread function (PSF) fitting technique seems to be the most robust and versatile way to obtain the accurate trail positions. However, the trails may not be line-shaped and the flux may not be constant along the trail in real images, especially for the trails longer than 100 pixels obtained by telescope with a small field of view. A number of factors contribute to the snaky trails: atmospheric turbulence, mechanical instability of the telescope, intrinsic flux changing etc. The astrometry techniques based on the assumption of a point spread function (PSF) tend to fail. We present a fresh source extraction pipeline based on template matching. Template matching is a method for searching and finding the location of a template image in a larger image. It simply slides the template image over the input image (as in 2D convolution) and compares the template and patch of input image under the template image. It returns a grayscale image, where each pixel denotes how much does the neighbourhood of that pixel match with template. Local maximum values of the grayscale image can be found and taken as the top-left corner of template. The coordinate of trail center in template can be acquired by trial fitting. Since the trail in template image is bright enough and well-prepared, the centering will be more accurate. Once the position of trail in template and the position of template in input image determined, the positions of trails in input image yielded. In this paper, this method was tested on simulation images and observation images obtained by 1m telescope of Weihai Observatory of Shandong University. The result illustrates that combination template matching and thresholding can improve the astrometry accuracy and give better detection rate and false alarm than traditional PSF fitting.