# A Method for Borehole Image Reverse Positioning and Restoration Based on Grayscale Characteristics
## 3 Reverse Positioning of Panoramic Imaging Probe
### 3D Reverse-Positioning Analysis Method for Probes  
In the actual conditions of borehole imaging tests, the borehole wall is not ideally uniform, and the grayscale value of each pixel of the borehole image is affected by minerals, pores, structural planes, and other factors. However, for any row \(j=h\) in the borehole image \(E(i,j)\), the overall trend of grayscale variation still conforms to the model described in (10). For the grayscale values \(D(i,h)\) of any row in the borehole image \(E(i,h)\), (10) is an overdetermined system. Hence, we utilize regression analysis to determine its parameters. To obtain the coordinates of the panoramic imaging probe \((k(h)\cdot r_{B},\theta_{0},h)\) from the grayscale values \(D(i,h)\) of each point in any row of the borehole image, we use the method of least squares estimation to compute the estimates \(\overset{\wedge}{\lambda^{0}}(h),\overset{\wedge}{k^{0}}(h),\overset{\wedge}{ \theta_{0}^{0}}(h)\) for the parameters \(\lambda\), \(k(h)\), and \(\theta_{0}(h)\) in (10), denoted as:  
\[\min\sum{(D(i,h)-\overset{\wedge}{D^{0}}(i,h))}^{2} \tag{11}\]  
where \(D\) represents the calculated value of (10) when parameters are set to \(l\), \(k\), and \(t\). The trust-region-reflective algorithm is a mature nonlinear optimization method widely used in solving nonlinear least squares optimization problems. Employing the algorithm to solve the optimization model (11), the estimators for parameters \(\lambda\), \(k(h)\), and \(\theta_{0}(h)\) at time \(t\) are obtained as \(\overset{\wedge}{\lambda^{0}}(h),\overset{\wedge}{k^{0}}(h),\overset{\wedge}{ \theta_{0}^{0}}(h)\). For borehole wall section images with similar lithology, the surface reflectance \(K\) can be treated as constant. Therefore, in this section of borehole images, the parameter \(\lambda\) should also be fixed as a constant. The estimator \(\overset{\wedge}{\lambda}\) for parameter \(\lambda\) in borehole image \(E(i,j)\) can be expressed as:  
\[\overset{\wedge}{\lambda}=\frac{1}{n}\sum_{h=1}^{n}\overset{\wedge}{\lambda}^{0 }(h) \tag{12}\]  
After fixing the estimator for parameter \(\lambda\), the estimators \(\overset{\wedge}{k}(h)\), \(\overset{\wedge}{\theta}_{0}(h)\) for parameters \(k(h)\) and \(\theta_{0}(h)\) in (10) are obtained again using the least squares estimation method, denoted as  
\[\text{min}\sum\left(D(i,h)-\overset{\wedge}{D}(i,h)\right)^{2} \tag{13}\]  
where \(\overset{\wedge}{D}(i,h)\) represents the calculated value of (10) when parameters are set to \(\overset{\wedge}{\lambda}\), \(\overset{\wedge}{k}(h)\) and \(\overset{\wedge}{\theta}_{0}(h)\). By using solving the optimization (13), estimators for the probe's three-dimensional coordinates are obtained, denoted as \((\overset{\wedge}{k}(h)\cdot r_{B},\overset{\wedge}{\theta}_{0}(h),h)\). In summary, a three-dimensional reverse-positioning method for the imaging probe is proposed, and the algorithm flow is illustrated in Figure 6.  
Figure 7 depicts a typical borehole image under probe eccentricity in practical engineering, taken at a borehole depth of 24.2-25.2 m. Initially, the image is preprocessed to remove the scale, and only the effective borehole wall image portion is analyzed. A least squares regression analysis is conducted row-wise on the effective part of the borehole  
Figure 6: Algorithm flow of reverse positioning of borehole imaging probe. image. Taking the borehole depth of 24.50 m as an example, corresponding to row \(j=366\) in the borehole image, for the grayscale value \(D(i,366)\) of borehole image \(E(i,366)\) at this position, the estimators \(\lambda^{\overset{\wedge}{0}}(366)\), \(\lambda^{\overset{\wedge}{0}}(366)\), and \(\theta_{0}^{\overset{\wedge}{0}}(366)\) for parameters \(\lambda\), \(k(h)\), and \(\theta_{0}(h)\) were obtained through the least squares regression method, with results shown in Table 1. The regression equation curve is depicted in Figure 8a. By performing row-wise regression analysis, estimators for \(\lambda\), \(k(h)\), and \(\theta_{0}(h)\) are obtained.