## 4 Methods
### Generating of Unfolded Image Sequence  
After locating the drilled hole center, the annular effective region centered on the drilled hole center could be determined by setting the radii of inner and outer circles. Then it was used to generate the rectangular image. As the drilled hole center of each frame could be located automatically, the radii of the inner and outer circles were set to fixed values, so that each frame had the same annular region. Due to the continuity of video, when the drilled hole centers of two video frames move around, the annular regions will result in the overall displacement. Thus, the mosaic result image will not lose image information by setting a fixed radius, rather it simplifies the video processing. In order to unfold the forward-looking borehole video into a rectangular image sequence, we proposed a borehole video sequence unfolding method, which designed a virtual coordinate graph (VCG) to assist with coordinate mapping (CM), thereby reducing the calculations of coordinate transformation in the unwrapping process of each video frame and improving the unwrapping efficiency of the video sequence. The schematic diagram of the image unwrapping process is presented in Figure 4. The relationship between the polar and rectangular coordinates was established to map pixels in the annular effective region to the unfolded image. Subsequently, the pixels of the annular region were used to fill the unfolded image by the reverse-mapping method [29], as described below. In the front view image, \(O\) (\(x_{0},y_{0}\)) is the drilled hole center, \(r\) the radius of inner circle and \(R\) is the outer circle. \(P\) (\(x,y\)) is a point in the annular region and its corresponding point in the unfolded image is \(Q\) (\(u,v\)). The unfolded image is constructed in advance and the coordinate of point \(Q\) is used to calculate the coordinate of point \(P\). Then the pixel value of point \(P\) is assigned to point \(Q\). The relationship between two points in two spaces is as follows:  
\[\left\{ \begin{array}{l}x=x_{0}+(r+v)\sin\theta\\ y=y_{0}+(r+v)\cos\theta\\ \theta=\frac{R}{R}\end{array} \right., \tag{1}\]  
where, \(\theta\) is the polar angle of the annular image, (\(x_{0},y_{0}\)) is the coordinate of the center, (\(x,y\)) is the pixel coordinate of point \(P\) and (\(u,v\)) is the pixel coordinate of point \(Q\). The length of the unfolded image is \(2\pi R\) (with the circumference of the largest radius), and the width is \(R\)-\(r\) (effective width for the analogy ring). In this research, the size of the front view image was 300 pixels \(\times\) 238 pixels. To ensure that the unfolded image could include more effective information, the size of \(r\) and \(R\) were set to 50 and 110 respectively. Thus, the size of the unfolded image was 660 pixels \(\times\) 60 pixels (\(M=2\pi R=660\), \(N=R\)-\(r=60\)). The front view borehole-wall image captured by AVBCS is a kind of distorted image with its imaging characteristics being that the pixels on the ring of the same radius are uniformly distributed, but they are not uniform in the radial direction. Therefore, image quality of the inner ring degrades more than its outer ring. To generate the unfolded images, we used the interpolation algorithm to fill the  
Figure 4: Unwrapping process of front view borehole-wall image. missing pixels for the inner rings. The nearest neighbor, bilinear and cubic convolution interpolations are three major interpolation algorithms used in image processing [30]. Nearest neighbor interpolation has the advantages of less operations and faster speed, while the unfolded image has low quality, and the problems of contour jaggies and mosaic appearance are serious. The application of bilinear interpolation can obtain the satisfactory result, but the computation is larger than the nearest neighbor interpolation.