# A Method for Borehole Image Reverse Positioning and Restoration Based on Grayscale Characteristics
## 2 Panoramic Borehole Image  
Borehole imaging technology is an optical-based imaging detection method used for in situ imaging of borehole walls. It records undisturbed images of the borehole walls to form a 360\({}^{\circ}\) panoramic image, obtaining geometric parameters of the borehole wall rock mass structure. The data for this study were derived from a digital panoramic borehole camera system (DPBCS) developed by the Institute of Rock and Soil Mechanics, Chinese Academy of Sciences. This system utilizes a truncated cone mirror panoramic imaging structure design, allowing real-time observation of the 360\({}^{\circ}\) panoramic situation of the borehole wall. It generates planar unfolded images of the borehole wall and three-dimensional core images, measures fracture geometric parameters such as dip direction, dip angle, and aperture, and achieves three-dimensional visualization of boreholes. This system effectively aids in the digital storage, processing, and analysis of geological data. As illustrated in Figure 1, the system comprises imaging probes, depth encoders, cables, and integrated control boxes. During the operation of the DPBCS, the CMOS camera of the panoramic imaging probe continuously captures images of the borehole wall reflected by the truncated cone mirror. The electronic compass captures and records the azimuth information of the borehole wall images, while the depth encoder records the depth position information of the probe. The integrated control box processes and stores the above data to form a panoramic image file for the borehole wall. PC analysis software further processes the data to generate borehole images and conduct image processing and analysis. To obtain borehole images, it is necessary to unfold and transform the circular panoramic images. As shown in Figure 2, a circular scanning line concentric with the circular image is determined on the panoramic image. A cylindrical coordinate system is established with the scanning line center as the pole and the true north direction as the polar axis. For a circular scanning line with a radius of r, the pixel value at any point on the scanning line is denoted as \(R(r,\theta,h)\), where \(\theta\) represents the azimuth angle and \(h\) represents the depth of the borehole. To determine \(\theta\), the electronic compass is used. Since the 0 direction of the electronic compass is fixed as vertically upward on the image, the true north direction in the image can be identified based on the compass reading. The azimuth angle of any point in the image is then determined relative to the true north direction. To determine \(h\), the depth value for the current video frame is directly obtained from the depth encoder reading, which represents the probe's depth within the borehole. By unwrapping the scanning images at different depths around the probe axis, borehole images \(E(i,j)\) can be obtained. The pixel value at the \(i\)-th row and \(j\)-th column of the borehole image is denoted as \(E(i,j)=R(r,i,j)\), where the horizontal coordinate of the image is the azimuth angle with the range of \([0,2\pi)\), and the vertical coordinate is the depth of the borehole. When the borehole imaging system is operating, the severity of probe eccentricity increases as the difference between the borehole diameter and the probe diameter grows larger. Additionally, factors such as borehole inclination, borehole fluid conditions, and the descent speed of the probe can all influence the extent of eccentricity. During the descent, the probe may slide down along one side of the borehole wall, or exhibit irregular swinging across the entire borehole cross-section. This results in uneven illumination on the borehole  
Figure 1: Digital panoramic borehole camera system. Figure 2: Schematic of panoramic image transformation.