# An Accurate GNSS Spoofing Detection Method Based on Multiscale Eye Diagrams
## 3 Spoofing Detection Method
### Msc-Mmp  
MSC-MMP is of paramount importance throughout the process of the EDDM-MSC-MMP, as it determines the algorithm's capacity to extract the edge of the eye diagram. Among edge detection algorithms, the traditional Canny algorithm often performs inadequately when extracting detailed edge information from eye diagrams [28]. This defi  
Figure 1: EDDM-MSC-MMP detection process. ciency of the method results in a reduction in the accuracy of the eye diagram analysis. As the direct application of the Canny algorithm for spoof signal detection may be unreliable, this study presents a multiscale Canny algorithm based on the minimum misjudgment probability. The proposed algorithm addressed the challenge of capturing the fine texture of edges and accurately positioning edges when a large Gaussian window is used. It also avoided retaining an excessive number of texture edges with a small-scale window, markedly increasing the precision of edge detection in the eye diagram. This enabled the subsequent calculations of eye height and the identification of potential spoofing signals. The MSC-MMP algorithm (Figure 2) initially constructed a three-layer image pyramid using the original image. Subsequently, Canny edge detection was performed on each layer of the image, and the threshold with the minimum misjudgment probability was calculated for these three images of varying scales to obtain three edge images. Ultimately, by fusing these three edge images, a precise and comprehensive edge result was obtained. The initial image is denoted as \(G_{0}\), which was set as the bottom layer (layer 0) of the Gaussian pyramid. When layer \(i\) in the Gaussian pyramid was created, Gaussian convolution was first performed on the image in layer \(i-1\). This was followed by a downsampling step, which generated an image with a lower resolution. In this process, the height and width of the new image were halved; that is, the image dimensions were half those of the previous layer image. \[G_{i}(x,y)=\sum_{j=-2}^{2}\sum_{k=-2}^{2}F(j,k)G_{i-1}(2x+j,2y+n) \tag{4}\]  
where \(G_{i}(x,y)\) represents the image in layer \(i\), and \(F(j,k)\) denotes the \(5\times 5\) kernel function, which exhibits low-pass characteristics. Once the three-layer Gaussian pyramid images, designated \(G_{0}(x,y)\), \(G_{1}(x,y)\), and \(G_{2}(x,y)\), were obtained, the minimum misjudgment probability algorithm was employed to ascertain the optimal high threshold (Th) of the Canny operator. It was assumed that the probability density function of the pixels in the foreground of the image is \(f(x)\), the probability density function of the pixels in the background is \(b(x)\), and the foreground and background pixels account for \(\phi_{1}\) and \(\phi_{2}\) of the total pixels in the image, respectively. The probability that a foreground pixel is misclassified as background is  
\[E_{\phi_{1}}(T)=\phi_{1}\int_{T}^{\infty}f(x)dx \tag{5}\]  
where \(T\) represents the assumed segmentation threshold. The probability of a background pixel being misclassified as foreground is  
\[E_{\phi_{2}}(T)=\phi_{2}\int_{-\infty}^{T}b(x)dx \tag{6}\]  
Figure 2: MSC-MMP algorithm flowchart. The overall error segmentation probability resulting from the application of threshold \(T\) is  
\[E_{\phi}(T)=\phi_{1}\int_{T}^{\infty}f(x)dx+\phi_{2}\int_{-\infty}^{T}b(x)dx \tag{7}\]  
To obtain the minimum error segmentation probability \(E_{\phi}(T)\), an iterative method was employed to identify the optimal segmentation threshold \(T\). The following steps are used:  
1. Estimate the image threshold \(T\) \[T=\frac{M_{\text{max}}+M_{\text{min}}}{2}\] (8) where \(M_{\text{max}}\) and \(M_{\text{min}}\) are the maximum and minimum gray levels of the image. 2. Split the image to obtain two sets of pixels. \[\varphi(x,y)= \begin{cases}1,&G_{i}(x,y)>T\\ 0,&G_{i}(x,y)\leq T\end{cases} \] (9) where \(\varphi_{1}\) is the set of all pixels with a grayscale value greater than \(T\) and where \(\varphi_{2}\) is the set of all pixels with values less than or equal to \(T\). 3.