# Binary Ghost Imaging Based on the Fuzzy Integral Method
## 2 Theory and Methods
Therefore, the calculation processing of the fuzzy integral image in the proposed method can avoid wasting computational effort in the element sorting. As shown in Figure 2, Step 1 in the proposed method is to calculate the integral image of each speckle distribution. The integral image has the same dimension as the speckle distribution. For the kth speckle distribution \(I^{(0)}(x,y)\) with \(r\) rows and \(c\) columns, the  
Figure 2: The flow chart of binarization algorithm. numbers of rows and columns of corresponding integral image \(S^{(k)}(x,y)\) are also \(r\) and \(c\), respectively. The integral image \(S^{(k)}(x,y)\) is calculated as:  
\[S^{(k)}(x,y)=\sum\limits_{i<x}\sum\limits_{j<y}l^{(k)}(i,j). \tag{3}\]  
In order to reduce the computational complexity of the integral image, the SAT algorithm is used, which is essentially a recursive algorithm. The schematic of the computation of SAT is shown in Figure 3. As Figure 3 shows, the speckle distribution is divided into four areas highlighted in red, blue, green, and pink. The pixel in the lower right corner of speckle distribution is denoted as \((x,y)\). Therefore, the summed values of different area can be expressed as:  
\[\left\{ \begin{array}{l}Sum_{red}=\sum\limits_{i<x-1}\sum\limits_{j<y-1}I^{( k)}(i,j)\\ Sum_{green}=\sum\limits_{i=xj<y-1}I^{(k)}(i,j)\\ Sum_{blue}=\sum\limits_{i<x-1}\sum\limits_{j=y}I^{(k)}(i,j)\\ Sum_{pink}=I^{(k)}(x,y)\end{array} \right.. \tag{4}\]  
According to the definition of the integral image, the value of the integral image at position \((x-1,y-1)\), \((x-1,y)\), \((x,y-1)\), and \((x,y)\) can be, respectively transformed as:  
\[\left\{ \begin{array}{l}S^{(k)}(x-1,y-1)=\sum\limits_{i<x-1}\sum\limits_{j<y- 1}I^{(k)}(i,j)\\ S^{(k)}(x-1,y)=\sum\limits_{i<x-1}\sum\limits_{j<y-1}I^{(k)}(i,j)+\sum\limits_{i <x-1}\sum\limits_{j=y}I^{(k)}(i,j)\\ S^{(k)}(x,y-1)=\sum\limits_{i<x-1}\sum\limits_{j<y-1}I^{(k)}(i,j)+\sum\limits _{i<x-1}\sum\limits_{j=y}I^{(k)}(i,j)+\sum\limits_{i=xj<y-1}I^{(k)}(i,j)+l^{( k)}(x,y)\end{array} \right.. \tag{5}\]  
Substituting Equation (4) into Equation (5), the following results can be obtained:  
\[\left\{ \begin{array}{l}S^{(k)}(x-1,y-1)=Sum_{red}\\ S^{(k)}(x-1,y)=Sum_{red}+Sum_{blue}\\ S^{(k)}(x,y-1)=Sum_{red}+Sum_{green}\\ S^{(k)}(x,y-1)=Sum_{red}+Sum_{green}+Sum_{blue}+Sum_{pink}\end{array} \right.. \tag{6}\]  
By solving the Equation (6), the value of the integral image at the position \((x,y)\) is:  
\[S^{(k)}(x,y)=I^{(k)}(x,y)+S^{(k)}(x,y-1)+S^{(k)}(x-1,y)-S^{(k)}(x-1,y-1), \tag{7}\]  
which specifies \(\{S^{(k)}(x,y)=0\ |\ x=0\ \text{or}\ y=0\}\). Secondly, the fuzzy integral image \(F^{(k)}(x,y)\) can be calculated based on the integral image \(S^{(k)}(x,y)\). As Step 2 shows in Figure 2, for calculating the fuzzy integral value of the position \((x,y)\), the values in the green box of integral image should be picked out and transformed to an ordered vector \(\mathbf{v}=[v_{1},v_{2},v_{3},v_{4}]\), where \(v_{1}\leq v_{2}\leq v_{3}\leq v_{4}\). According  
Figure 3: The relationship between the speckle distribution and integral image. to the property of integral image \(S^{(k)}(x,y)\), it can be seen that the minimum value of the green box is located at the left upper corner, and the maximum value of the green box is located at the right lower corner. Hence, \(v_{1}=S^{(k)}(x-1,\,y-1)\) and \(v_{4}=S^{(k)}(x,y)\). For further sorting, \(S^{(k)}(x,y-1)\) is compared with \(S^{(k)}(x-1,y)\) in order to set the maximum value to \(v_{3}\) and the minimum value to \(v_{2}\). By convention, an element 0 is added before the vector \(\mathbf{v}\) to form the final sorted vector \(\mathbf{v}_{o}\). Moreover, in order to calculate the Choquet integral, the fuzzy measure vector m should be obtained as follows:  
\[\mathbf{m}=[\mu(E_{1}),\mu(E_{2}),\mu(E_{3}),\mu(E_{4})]. \tag{8}\]  
Here, \(E_{i}=\{v_{i},\,\ldots,\,v_{4}\}\), \(I=1,\,\ldots,\,4\) is the subset of vector \(\mathbf{v}\), and \(\mu\) is assumed to be the symmetric fuzzy measure.