# A Geometric Dictionary Learning Based Approach for Fluorescence Spectroscopy Image Fusion
## 2 Geometry Dictionary Construction and Fusion Scheme
### Geometric-Structure-Based Patches Classification  
Image blocks of a source image can be classified by various image features in describing underlying relationships. According to geometry descriptions, the multi-focus source images can be divided to smooth, stochastic, and dominant orientation patches. The edges of focused area are usually sharp that contain dominant orientation patches. The out-of-focused areas are smooth that contain a large number of smooth blocks. Besides that, there are also lots of stochastic blocks in source images. Grouping image blocks into different classes for dictionary learning is an efficient way to improve the accuracy of image description. To obtain different geometry sub-classes, this paper uses a geometric-structure-based approach to partition image into several sub-classes first. Then based on the classified image blocks, it gets the corresponding sub-dictionaries. Before doing geometry analysis, it needs to divide the input image into \(\sqrt{w}\times\sqrt{w}\) small image blocks \(P_{l}=(p_{1},p_{2},...,p_{n})\) first. Each image patch \(p_{i},i\in(1,2,...n)\) is converted into \(1\times w\) image vectors \(v_{i},i\in(1,2,...n)\). After obtaining vectors, the variance \(C_{i}\) of pixels in each image vector can be calculated. After obtaining variance, it needs to choose the threshold \(\delta\) to evaluate whether image block is smooth. If \(C_{i}<\delta\), image block \(p_{i}\) is smooth, otherwise image block \(p_{i}\) is not smooth [39]. Based on the threshold \(\delta\), the classified smooth and non-smooth patches are shown in Figure 2a,b respectively. According to the classified smooth and non-smooth patches shown in Figure 2a,b, it is clear to find that the smooth patches have similar structure information of input images. Oppositely, non-smooth patches are different and cannot be directly classified into one class. Figure 1: Geometric Dictionary based Image Fusion Framework. Non-smooth patches may also be classified. According to geometric patterns, non-smooth patches could be divided into stochastic and dominant orientation patches. The separation method of stochastic and dominant orientation image patches consists of two steps. In the first step, the gradient of each pixel is calculated. In every image vector \(v_{i},i\in(1,2,...n)\), the gradient of each pixel \(k_{ij}\), \(j\in(1,2,...,w),i\in(1,2,...n)\) is composed by its \(x\) and \(y\) coordinate gradient \(g_{ij}(x)\) and \(g_{ij}(y)\). The gradient value of each pixel \(k_{ij}\) in image patch \(v_{i}\) is \(g_{ij}=(g_{ij}(x),g_{ij}(y))\). The \((g_{ij}(x),g_{ij}(y))\) can be calculated by \(g_{ij}(x)=\partial k_{ij}(x,y)/\partial x\), \(g_{ij}(y)=\partial k_{ij}(x,y)/\partial y\). For each image vector \(v_{i}\), the gradient \(G_{i}\) is \(G_{i}=(g_{i1},g_{i2},...,g_{iw})^{T}\), where \(G_{i}\in\mathbb{R}^{w\times 2}\). In the second step, the gradient value of each image patch is decomposed by Equation (1):  
\[G_{i}=\left[ \begin{array}{c}G_{i1}\\ G_{i2}\\...\\ G_{iw}\end{array} \right]=U_{i}S_{i}V_{i}^{T}\ \, \tag{1}\]  
where \(U_{i}S_{i}V_{i}^{T}\) is the singular value decomposition of \(G_{i}\). \(S_{i}\) is a diagonal \(2\times 2\) matrix for representing energy in dominant directions [47]. When \(S_{i}\) is obtained, the dominant measure \(R\) can be calculated. The calculation method of \(R\) is shown in Equation (2):  
\[R=\frac{S_{1,1}-S_{2,2}}{S_{1,1}+S_{2,2}}\ \, \tag{2}\]  
The smaller the \(R\) is, the more stochastic the corresponding image patch is [48]. In this case, a threshold \(R^{*}\) should be calculated for distinguishing stochastic and dominant orientation patches. To find the threshold \(R^{*}\), a probability density function (PDF) of \(R\) is calculated. According to [42], the PDF of R can be calculated by Equation (3).