## 2 Stereo Reconstruction Algorithm for Unstructured Scenes
### SAD-FAST Feature Detection and Recombination Stereo-Matching System
#### 2.1.1 SAD-FAST Feature Detection  
The FAST feature detection algorithm was proposed by [PERSON] in 2006 and is one of the currently accepted fast corner-point detection algorithms. The FAST feature detection algorithm determines whether a pixel is a feature by comparing the magnitude of the gray value of the pixel with those of its surrounding neighborhood and characterizes the feature orientation by determining the gray gradient around the feature. This process is simple, easy to implement, and efficient. However, in the actual environment, due to the uncertainty of light and surrounding environment information, it is very easy for a sharp decrease in the number of feature points to occur when the environmental contrast ratio decreases. Based on the above, we propose a self-adaptive threshold value method for SAD-FAST feature detection. When using conventional FAST for feature point detection, the grayscale difference threshold used is artificially set. When the light intensity and the surrounding environment's contrast ratio changes, the number of detected feature points will be reduced, which can easily lead to inaccurate experiments and other results. Based on the above problems, we propose a self-adaptive threshold value calculation method. Firstly, we calculate the image contrast ratio; i.e., the degree of stretching contrast between light and dark. \[C=\sum_{\delta}\delta(i,j)^{2}P_{\delta}(i,j) \tag{10}\]  
where \(\delta(i,j)=ji\quad j/\) is the grayscale difference between adjacent pixels. \(P_{\delta}(i,j)\) is the probability of a pixel distribution with a grayscale difference of \(\delta\) between adjacent pixels. Based on the derived image contrast ratio \(C\), the self-adaptive threshold value \(t\) can be designed with the formula:  
\[t=\alpha C \tag{11}\]  
where \(\alpha\) is the self-adaptive parameter, and the value is determined according to the experimental data. As shown in Figure 4, let the point to be detected be \(P\), with \(P\) being the center of a circle and three pixel points as the radius forming a circle field. Take 16 pixel points on the edge of the circle, set the grayscale threshold \(t>0\), and compare the magnitude of the grayscale value \(I(x)\) of each pixel point \(x\) on the circle with the grayscale value \(I(P)\) of \(P\). It is easy to see that three cases can occur:  
\[ \begin{array}{ll}I(x)&I(P)>t,\text{ and point }x\text{ is brighter than point }P;\\ I(P)&I(x)>t,\text{ and point }x\text{ is darker than point }P;\\ t&I(x)&I(P)\quad t,\text{ and the two points are of equal brightness.}\end{array} \]  
Although a large number of non-angular regions can be eliminated with the traditional FAST detection algorithm, there are still several obvious shortcomings. First, in the pixeltest of 16 surrounding pixel points, the traditional FAST algorithm only considers the pixel difference or brightness degree of 4 pixel points to determine whether a point should be classified as a corner point, without more stringent screening. Second, the choice of pixels is not exactly optimal. Third, multiple features are easily detected in close proximity to each other. To address the above issues, we improved the feature determination of FAST. First, define a threshold value. The pixel difference between \(P(1)\), \(P(9)\), and the center \(P\) are then calculated. If their absolute values are less than the threshold, the point \(P\) cannot be a feature point; otherwise, it is classified as an alternative point for the next step. If point \(P\) is an alternative point, the pixel differences between \(P(1)\), \(P(9)\), \(P(5)\), \(P(13)\), and the center \(P\) are calculated, and if at least three of their absolute values exceed the threshold, then point \(P\) is classified as an alternative point; otherwise, it is not. If point \(P\) is an alternative point, the pixel difference between a total of 16 points from \(P(1)\) to \(P(16)\) and the center \(P\) is calculated, and if at least 12 of them exceed the threshold, then \(P\) is determined to be the alternative point.