## 2 Cross-correlation, Phase Correlation and Their Modifications  
The cross-correlation method has many applications for signals analysed in the time domain. It is useful in cases where the measurement resolution is high and when the determined shift is much larger than the length of the analysed signal shape. Detecting the maximum of such a correlation function is possible, in principle, with accurate resolution of the signal measurement. Some increase in accuracy can be achieved by interpolating the correlation function at additional points. In the case of the analysis of optical spectra, the limitation is the spectral resolution of the optical measurement. If \(S_{1}(\lambda)\) is the spectrum  
Correlation methods for images use two ways to improve the accuracy of shift estimation [15]. The first is a better interpolation of the cross-correlation function in the fundamental domain [16]. The second is the processing of the cross-power spectrum itself. It is also possible to pre-amplify specific signal features through bandpass filtering. Various weighting functions are also used for selected signal types. Such an algorithm can be written mathematically as [17]:  
\[C_{c}(m)=\mathcal{F}^{-1}(\varphi(k)\cdot X_{1}(k)\cdot X_{2}^{*}(k)), \tag{9}\]  
where in the simplest formula (normalized cross-power spectrum), the weight function will take the form:  
\[\varphi(k)=\frac{1}{|X_{1}(k)|\cdot|X_{2}(k)|}. \tag{10}\]  
The weight function is intended to sharpen the peak generated in the fundamental correlation domain as well as reduce the influence of noise. The algorithm using weight functions is called generalised cross-correlation [18]. For shift estimation in the field of images, computationally fast methods are also sought. The correlation computed in the Fourier domain using the fast Fourier transform is a computationally efficient algorithm. Analysis of the result in the fundamental domain gives good results in the case of large shifts in the signal shape. For shifts comparable to the measurement resolution and smaller, more accurate information will be obtained based on the Fourier transform phase if we write the Fourier transforms of both spectra as  
\[X_{1}(k)=|X_{1}(k)|\cdot e^{-j\varphi_{1}(k)}, \tag{11}\]  
\[X_{2}(k)=|X_{2}(k)|\cdot e^{-j\varphi_{2}(k)}. \tag{12}\]  
Multiplication in the Fourier domain means the product of the transform modules and the product of the exponents related to the phase. Therefore, if both modules are identical:  
\[|X_{1}(k)|=|X_{2}(k)|. \tag{13}\]  
There is only a phase difference between both signal spectra:  
\[\Delta\varphi(k)=\phi_{2}(k)-\phi_{1}(k). \tag{14}\]  
The phase difference can be calculated for each frequency with index \(k\):  
\[\Delta\varphi(k)=\frac{2\cdot\pi\cdot k\cdot\Delta\lambda(k)}{N\cdot\delta}, \tag{15}\]  
For each frequency with index \(k\), the shift associated with the phase change is  
\[\Delta\lambda(k)=\Delta\varphi(k)\cdot\frac{N\cdot\delta}{k\cdot 2\cdot\pi},\ k=1, 2,\ldots M<N. \tag{16}\]  
This principle is used by the fast-phase correlation method [19]. Because the measurement data contain noise and the signal shape itself may be slightly distorted, the shifts calculated for each frequency will differ. Therefore, to determine the correct shift value, the median of several M initial frequencies is used [19]:  
\[\Delta\lambda(k)=\Delta\varphi(k)\cdot\frac{N\cdot\delta}{k\cdot 2\cdot\pi},\ k =1,2,\ldots M<N. \tag{17}\]  
In all methods using the Fourier transform phase, the problem is the uniqueness of the determined phase. The phase value can range from \(-\pi\) to \(+\pi\). A method to reduce ambiguity is to rotate the measured signal so that the difference in shifts is less than one sample in the wavelength domain. The total shift is, therefore, equal to the integer and fractional parts of \(\delta\lambda\)[20]. A similar method called shifted phase correlation has also been recently proposed for shape from focus measurements [21].