## 2 Related Work  
To stitch an integral panorama from a borehole video acquired by AVBCS, the front view borehole-wall image sequences obtained from the videos are first unfolded to the rectangular image sequences by the image unwrapping module. There are three basic unwrapping methods: The ray-tracing algorithm (RT) [12], look-up tables algorithm (LUTs) and the coordinate mapping algorithm (CM). In the literature [13], an image unwrapping method for spherical omnidirectional images was proposed with the RT method. However, the camera needs to be calibrated to obtain the parameters describing the spherical omnidirectional sensor in their method. [PERSON] et al. [14] adopted the LUTs algorithm to unfold the catadioptric omnidirectional images and [PERSON] et al. [15] used decimal encoding and LUTs to create the iris template. However, the LUTs algorithm is built on the RT algorithm, which needs complex mapping libraries. In contrast, the CM algorithm is simple and efficient, and is widely used in polar-to-rectangular image transformation. [PERSON] et al. [16] applied the CM algorithm to a panoramic image with a visual field of 360 degrees to generate an unwrapped image. Their camera can obtain a lossless panoramic image by a parabolic reflector, thus the CM algorithm is used as a one-to-one mapping from the panoramic image to the unwrapped image. However, the front view image obtained by AVBCS in this study is a distorted image and the CM algorithm cannot be used directly. Therefore, in this paper, we introduce the interpolation algorithm to the CM algorithm to fill the missing pixels in the image unwrapping process. After the rectangular image sequences are generated, they are stitched together as one single cylindrical panorama. The image matching of consecutive frames is a critical step in the mosaic process, which can be broadly categorized into feature-based matching and pixel intensity-based matching [17]. The feature-based methods such as Harris [18], SIFT or SURF [19] assume that distinct feature points in both the source image and the examined image can be reliably detected and elaborated by image descriptors. Given enough potent matches of feature points, it is possible to estimate the matching parameters between two images. These methods assume that the same feature points can be detected and paired successfully. However, low contrast, blur and low texture lead to a significant amount of matching ambiguity. Furthermore, the processing speed of these methods is hard to meet the real-time processing at the video frame rate. On the other hand, pixel intensity-based algorithms can be very robust even in low contrast images, and the template matching algorithm (TM) is the most commonly used algorithm in video image mosaics [20]. Since the TM has the advantages of simple calculation and requiring less information of the template, it has been widely used in image mosaics, pattern recognition, object tracking and so on [21]. In general, the TM involves shifting a template obtained from a source image over a search area in an examined image, measuring the similarity between the template and the current search area, and identifying the best candidate image, which matches the template most. As similarity measure methods, the normalized cross correlation (NCC) [22] and sum of absolute difference (SAD) [23] are the two most well-known and widely used in TM applications. Although NCC is more robust than SAD under variable illumination conditions, it needs to compute the numerator and denominator, which is more time-consuming than SAD. SAD is widely applied to video image matching due to its simplicity. In order to improve the efficiency of template matching, some researchers proposed several new search strategies for SAD. [PERSON] et al. [24] proposed an intellectual switching strategy by setting a fixed threshold for SAD to select the spatial correlation-based scheme or the temporal prediction scheme to maximize the quality improvement of the marked mosaic videos. [PERSON] et al.