# A Novel Data-Aided Frame Synchronization Method Based on Hough Transform for Optical Communications
## 3 HT-Based Frame Synchronization Algorithm
### Algorithm  
In the context of non-cooperative communications, \(M\), \(N\), and the type of \(S\) are all unknown, which require to be recognized blindly for frame synchronization [32]. Blind recognition of frame parameters can be implemented through the properties of frame synchronization word, which are fixed and cyclical. To achieve this, the interception matrix \(C\), with \(r\) rows and \(l\) columns, is built by filling it with the intercepted bit stream from top left to bottom right. As shown in Equation (5), \(Y\) is the intercepted bit stream. \[Y=\left( \begin{array}{cccc}y_{1},&y_{2},&y_{3},&\ldots\end{array} \right) \stackrel{{ full~{}in}}{{\Rightarrow}}\left( \begin{array}{cccc}y_{1} &y_{2}&\ldots&y_{l}\\ y_{l+1}&y_{l+2}&\ldots&y_{2l}\\ \vdots&\vdots&\ddots&\vdots\\ y_{(r-1)l+1}&y_{(r-1)l+2}&\ldots&y_{rl}\end{array} \right)=\left( \begin{array}[] {cccc}c_{1,1}&c_{1,2}&\ldots&c_{1,l}\\ c_{2,1}&c_{2,2}&\ldots&c_{2,l}\\ \vdots&\vdots&\ddots&\vdots\\ c_{r,1}&c_{r,2}&\ldots&c_{r,l}\end{array} \right)=C \tag{5}\]  
There are two cases for the number of columns of interception matrix \(C\), \(l~{}\
eq~{}kl~{}(k~{}\in~{}Z^{+})\) and \(l~{}=~{}kl\). In case of \(l~{}=~{}kl\), all elements of certain columns are either 0 or 1, which are called synchronization-word columns in this paper, while elements of other columns are random, and we call these non-synchronization-word columns. In the case of \(l~{}\
eq~{}kl\), there do not exist synchronization-word columns yet. Based on this property, all we need to do is to go through all possible values of \(l\) to estimate the frame length \(L\) and synchronization word position. As we all know, \(y_{i}~{}=~{}0\) or \(1~{}(i~{}\in~{}Z^{+})\), which means the interception matrix \(C\) is filled with 0 and 1. If we consider \(C\) as the image space, in which 0 is black and 1 is white, it can be displayed as a binary image in Figure 4. The two cases, that \(l~{}\
eq~{}kl\) and \(l~{}=~{}kl\), are shown in Figure 4a,b, respectively. The synchronization-word columns appear as black and white straight stripes in a binary image, while the non-synchronization-word columns appear as snowflake noise. Figure 3: Example of line detection based on Hough transform (HT). (**a**) Image space with five points in a black background; (**b**) Hough space. To identify the case that \(l\ =\ kl\) when going through all possible values of \(l\), line detection based on Hough transform can be applied. However, there practically exist collinear points at any angle in the image space \(C\), which means straight lines can be detected with taking any values. Considering that the number of collinear points in the synchronization-word columns is the largest in the vertical direction, we just need to simply find the accumulator cells with the most counts at \(\theta\ =\ 0^{\circ}\) in Hough space for all \(l\). The recognition algorithm is summarized as follows. Step1. Set the search range of \(l\) and initialize it. (Assume that \(l\in\ [l_{min},l_{max}]\));  
Step2. Fill the image space \(C_{rcl}\) with the intercepted bit stream \(Y\) from top left to bottom right;  
Step3. Perform edge extraction on image space;  
Step4. Quantify \(\theta\) and \(\rho\). For each non-background point in image space \(C_{rcl}\), calculate its corresponding sinusoid according to Equation (4) and fill the curve into Hough space by incrementing the count in each accumulator cell along the curve;  
Step5. Record the largest counts among all the accumulator cells at \(\theta\ =\ 0^{\circ}\) in Hough space. Let it be \(x_{l}\). Step6. If \(l\ <\ l_{max}\), let \(l\ =\ l\ +\ 1\) and return to Step2. Otherwise, execute Step 6;  
Step7. Fill all the \(x_{l}\) into vector \(X\) and find the maximum value. Let it be \(x_{max}\);  
\[X=\left( \begin{array}{cccc}x_{l_{min}},&x_{l_{min}+1},&\cdots,&x_{l_{max}} \end{array} \right) \tag{6}\]  
Step8.