# A Method for Borehole Image Reverse Positioning and Restoration Based on Grayscale Characteristics
## 3 Reverse Positioning of Panoramic Imaging Probe
### Borehole Image Grayscale Feature Model  
When the panoramic imaging probe operates within the borehole, the annular light source illuminates the borehole wall through the truncated cone mirror, and the CMOS camera captures the panoramic image formed by the reflection of the cone mirror, as shown in Figure 4.  
Figure 3: Brightness variation bands in a borehole image. According to the principles of optical imaging, the geometric distance S from the light source to a point on the borehole wall captured by the CMOS camera can be represented as:  
\[ \begin{array}{l}S=h_{s}+\rho\cos(t)\csc(t+2\psi)+h_{l}\\ t=\arctan\frac{r}{h_{c}+(r-r_{0})\tan(\psi)}\\ h_{l}=(r-r_{0})\tan(\psi)\end{array}  \tag{1}\]  
where \(\rho\) is the horizontal distance between the center of the probe and a point on the borehole wall; \(r\) is the radius of the scanning line; \(h_{l}\) is the distance between the scanning line and the top surface of the truncated cone mirror; \(t\) is a parameter; \(r_{0}\) is the radius of the top surface of the truncated cone mirror; \(h_{s}\) is the distance between the light source inside the probe and the end surface of the truncated cone mirror; \(h_{c}\) is the distance between the optical center of the CMOS camera and the upper surface of the truncated cone mirror; and \(\psi\) is the bottom angle of the truncated cone mirror. According to geometric principles, the angle \(\varphi\) between the light rays from the probe light source and the normal to the borehole wall is expressed as:  
\[\varphi=\frac{\pi}{2}-2\psi. \tag{2}\]  
As is shown in Figure 5, taking the borehole axis \(O_{B}\) at depth \(h=0\) as the pole, the true north direction as the polar axis, and the borehole axis as the \(z\)-axis, cylindrical coordinates are established for the borehole. Then, the cylindrical coordinates of the probe center \(O_{P}\) are \((k(h)\cdot r_{B},\theta_{0},h)\), where \(k(h)=D_{BP}(h)/r_{B}\), \(r_{B}\) is the radius of the borehole wall, \(D_{BP}(h)\) is the distance between the borehole wall axis \(O_{B}\) and the probe axis \(O_{P}\), and \(\theta_{0}\) is the angle between the polar axis and \(O_{B}O_{P}\). Figure 4: Imaging principle of borehole camera. 1—Borehole wall, 2—imaging probe, 3—CMOS camera, 4—light source, 5—truncated cone mirror. A cylindrical coordinate system is established for the probe with the probe center \(O_{P}\) as the pole, the true north direction as the polar axis, and the borehole axis as the \(z\)-axis. Then, the horizontal distance between the probe center and a point on the borehole wall can be calculated as:  
\[ \begin{array}{ll}\rho&=r_{B}\cdot\exp\Bigl{\{}k(h)^{2}[\cos(2\theta-2\theta_{ 0}(h))-1]/2+1\Bigr{\}}\\ &-r_{B}k(h)\text{Cos}(\theta-\theta_{0}(h))\end{array}  \tag{3}\]  
where \(\theta\) is the polar angle of a point on the borehole wall in the probe coordinate system. Illuminance refers to the light flux received per unit area. According to the illuminance law [31], the illuminance \(E\) of an object illuminated by a point light source can be calculated as:  
\[E=\frac{I}{S^{2}}\cos\varphi \tag{4}\]  
where \(I\) is the luminous intensity of the light source and the angle \(\varphi\) is defined in Equation (2). Brightness of a non-luminous body refers to the light flux reflected per unit area from the surface of an object [31]. The brightness \(B\) of a point on the borehole wall can be calculated as:  
\[B=K\cdot E \tag{5}\]  
where \(K\) is the surface reflectance of the borehole wall. During the imaging process, the grayscale value of each pixel of the image is related to the exposure at the corresponding position [32], expressed as:  
\[D(i,j)=\gamma\lg H(i,j)+m \tag{6}\]  
where \(D(i,j)\) is the grayscale value of a point on the image, \(H(i,j)\) is the exposure at that point, and \(\gamma\) and \(m\) are the sensitivity characteristic parameters of the CMOS sensor.