Simulation of speckle complex amplitude: advocating the linear model Sébastien Equis∗ and Pierre Jacquot Nanophotonics and Metrology Laboratory, Swiss Federal Institute of Technology Lausanne EPFL-STI-NAM, Station 11, CH-1015 Lausanne ABSTRACT The basic convolution integral, Uf = Uo ⊗ h , where Uo is a random object complex amplitude and h the impulse response of the system under consideration, serves to model the observed speckle field Uf. Depending on the choice of h, the simulated field is an objective or a subjective speckle pattern. The computation makes use of two consecutive Fast Fourier Transforms. In the reported examples, the object function represents a pure phase diffuser ruled by a uniform distribution. The probability density functions (PDF) of the simulated intensity and phase patterns fit very well with their analytical counterparts obtained under the classical Gaussian hypotheses. Phase maps exhibit the awaited singularities. Moreover, elements of second order statistics, as the autocorrelation functions, are in very good agreement too. Furthermore, subtle effects, as the dip of contrast in the focused image plane of partially developed speckle patterns, are also suitably disclosed. The linear model thus appears, all together, as conceptually easy, very flexible, computationally simple, very accurate for a wide range of experiments, and endowed with excellent predictive and speculative potentials. Keywords: Speckle simulations, speckle modelling, linear imaging model, statistical properties 1. INTRODUCTION “Experiments” involving speckle distributions are indeed frequently carried out firstly on a simulation basis. The underlying reasons are in the impossibility to exercise a perfect material control of all the parameters governing the speckle formation, especially the roughness parameters and their possible alterations. A great number of numerical models have therefore been built. These models most often are of an ad hoc nature, limited to the validation of particular findings. Such approaches span an horizon as wide as the analysis of surface roughness versus speckle contrast1, the statistical study of intensity and phase in the vicinity of singularities2, the intrinsic speckle noise in Gabor particle holography3, the effectiveness of a wavelet filtering technique in speckle interferometry4, the noise evaluation in coherent fringe projection techniques5, the subjective significance of a given SNR in speckle interferometry6, the testing of unwrapping algorithms7, ... Sometimes, it is sufficient to introduce some sort of noise, additive or multiplicative, into the standard two-beam interference formula in order to give a speckle appearance to the fringe patterns under examination8. Artificial speckle patterns are also in use outside the visible part of the electromagnetic spectrum. Rare publications, on the contrary, are tackling the question of the elaboration of an explicit and realistic digital representation of a speckle field, mimicking as closely as possible the concerned physical processes4,9. Moreover, apart from elementary tests, very few in-depth validations have been attempted in order to guarantee the adequacy of the modelling. The linear amplitude imaging model is chosen here for creating numerical speckles. This model is dubbed for simplicity “linear model”. It starts from the basic and well-known convolution integral between object complex amplitude and impulse response for obtaining the output amplitude. Strongly grounded to the first principles, computationally efficient when the convolution integral is calculated by two Fast Fourier Transforms (FFT), this model creates pertinent complex speckle distributions. The linear model is relevant for both objective and subjective speckle amplitudes: it is just a matter of choosing the appropriate impulse response, which assumes respectively either the form of the FT of the pupil function or the Fresnel function. In an imaging geometry, arbitrary amounts of defocusing are also very easily modelled. We carefully confront the statistical properties of the numerically created speckle fields to the theoretical distributions a Gaussian speckle should obey. Very good statistical agreements between theory and model are obtained for the intensity ∗ sebastien.equis@epfl.ch and phase probability density functions, and hence for the moments of these random variables, in particular the contrast. More elaborate statistical properties, as the intensity autocorrelation functions, the average speckle size, the occurrence of singularities, are also correctly verified. Moreover, interesting results have been obtained in speckle interferometry, out of the scope of the present paper. The outlook is to use speckle fields generated by the linear model for testing and benchmarking automatic fringe processing methods developed for speckle interferometry. 2. THE LINEAR MODEL In the paraxial domain, the diffraction theory reduces to a very simple and general formula10: U f (r ) = U o (r ) ⊗ h(r ) (1) where Uo and Uf are respectively the complex amplitudes in the input and output planes, h the impulse response of the considered system and r the position vector (x,y) of modulus r, in the respective planes. In our case, Uo represents the complex amplitude at the surface of the diffusing object. Throughout this paper, without loss of generality and for the sake of simplicity, we will assume that the diffuser is a pure phase object, whose phase ϕ is uniformly distributed over a 2π interval: U o (r ) = exp jϕ (r ); with : pϕ (ϕ ) = 1 / 2π , − π ≤ ϕ ≤ π , and 0 otherwise (2) We are interested in knowing Uf in three types of diffracting “systems”: i) in free space propagation, a distance d separating the input and output planes, fulfilling the conditions of the Fresnel diffraction, and leading to the observation of a so-called objective speckle pattern; ii) in a perfectly focused imaging geometry, for simplicity at unit magnification, corresponding to a subjective speckle pattern; iii) and finally, for treating of 3D objects and longitudinal object motions, in a defocused geometry. The beauty of the paraxial diffraction theory is that the three cases differ only by the form of the impulse response. h is the Fresnel function in free space propagation and the Fourier Transform of the pupil function in an imaging geometry. Let us explicit somewhat these functions, with λ, Φ and f being respectively the wavelength, the pupil diameter and the focal length of the lens, and the pupil function being defined by: cir ( ρ ) = 1 for 0 ≤ρ ≤ Φ/2; 0 otherwise: ( i) free space propagation: h s (r ) = exp j (2π / λ ) r 2 / 2d ) ii) focused imaging: h f (r ) = FT {cir ( ρ )} = J 1 (q ) / q ; q = π Φ r / 2λ f ; J 1 : first kind, first order Bessel function (3) iii) defocused imaging: hd (r ) = FT {cir ( ρ ) exp jϕ a ( ρ )} = h f (r ) ⊗ h s (r ) ; ϕa is the defocus aberration function. Playing no role in our simulations, the proportionality factors have been omitted. ϕa takes a very simple analytical form in function of the amount of defocusing10. Adding a supplementary phase factor to the focused and defocused pupil functions allows taking into account further aberrations. It is also possible to treat the defocused imaging as a two steps process combining cases i) and ii) and consisting in a focused imaging followed by a free space propagation. Fig. 1 schematizes the three cases. Eq (1) appears thus as an extremely powerful means to describe our sought distributions. This fundamental relation is especially interesting when considered in the reciprocal Fourier space, which eases the computations and makes the most of the FT relationship between pupil and impulse response functions. x ⊗hs UO x’ Uf a) x ⊗hf UO Uf x’ b) x ⊗hd UO c) Uf x’ Figure 1: Schematic representation of the input and output complex amplitude distributions in a) free space propagation, b) focused imaging geometry and c) defocused imaging geometry. 3. SAMPLING AND COMPUTING CONSIDERATIONS In relation to Eqs. (1) and (2), the image field Uf can be simply computed by two Fast Fourier Transforms: U f = FT −1 {H ⋅ FT [exp( jϕ )]} , (4) with H=FT[h] designating the coherent transfer function, i.e. the pupil function. In a 4f configuration, and for a diffraction limited system, H reduces to the cir function, as seen above. The cut-off frequency, νc, of this system is then ν c = Φ / 4λf . This system cannot resolve details smaller than 1/ νc in amplitude, the double of the correlation length of the speckle pattern intensity. For the computations, we will take x and ν as the reciprocal variables of the FT, instead of x and ν/2λf in the physical system. 3.1 Sampling considerations – cardinal sampling We will consider square grids to sample our fields and their Fourier Transforms, as shown on Fig. 2. The band-pass characteristics of the system set strong conditions on the sampling parameters. As the highest spatial frequency is given by νc, the optimal sampling rates in object and image planes, δx=δy, are, according to the sampling theorem, δx=δy=1/2νc. The number N of sampled points, in one ν Nδx direction, is determined so that Nδx equals the object x νc and image sizes. N is chosen as the most acceptable y’ trade-off between image size and computation time. The sampling rate δν in Fourier space is then connected z to δx and N by: Nδxδν = 1 (5) y As shown in Fig. 2, the coherent transfer function is a matrix of 1 for (i − N 2) 2 + ( j − N 2) 2 ≤ {Nδxν c }2 Nδν and 0 otherwise. The factor δxν c is ½ according to the Uo H Uf Nyquist criteria and less than ½ when object and image Figure 2: Matrix representation for focused imaging planes are oversampled. By creating N×N object geometry. The dashed line in the pupil plane is the reduced pupil used for expanding speckle cells. amplitudes from Eq. (2), and applying Eq. (4), we are now able to compute the speckle field Uf. By proceeding this way, we obtain the speckle pattern shown in Fig. 3. Its histogram is depicted in Fig. 4, and compared with the theoretical probability density function (PDF) for the corresponding case. Nδx x’ 1 Histograms and PDF are normalized to the mean intensity on the abscissa and to 1 on the ordinate. Using the so-called box-car decomposition11, Goodman established that a suitable approximation of the PDF of integrated speckle pattern intensity is the Gamma distribution (Γd): ⎯ Hist(IS) -×- Γd 0.5 PI ( I ) = ( 0 m m I m −1 I ) exp(−m ) <I> Γ ( m) <I> (6) Γ(m) is the gamma function, and <I> the mean intensity. By fitting the histogram of Figure 3: Simulated speckle the computed intensity pattern, referred to intensity pattern in image plane. Hist(IS) on Fig.4, and Eq. (6) together, we found an m equal to 2.35. The obtained curve is plotted on Fig. 4. This result confirms the well known fact that a weak spatial integration regime already exists when the intensity pattern is observed – physically or mathematically – close to the system resolution limit. According to the box-car model, there are indeed 2.35 identical sub-areas exhibiting statistically independent intensity values within the resolution cell. 0 1 2 3 4 5 Figure 4: Histogram of simulated speckle pattern and Γd with m = 2.35. 3.2 Resolved and integrated speckle patterns Our model must be able to produce resolved as well as integrated speckle patterns. The unresolved case is simple: to simulate the pattern given by an integrating CCD camera, it suffices to sum the elements of the computed matrix field contained within the pixel area. For the resolved case, we have to sample the field more finely. We will however never reach the perfectly resolved case, giving rise in theory to a decreasing exponential PDF for the intensity. This is because it is impossible, both physically and computationally, to consider an ideal point detector. Yet we know12 from experiments that we can closely approach a fully resolved speckle pattern by using a detection aperture whose dimension is one order of magnitude lower than the size of the resolution cell. Our simulations confirm the point. The easiest way to extend the speckle cell on the sampling image grid is to reduce the pupil diameter in the matrix H, (Fig. 2). This is equivalent to sample more finely both object and image planes. It is worth emphasizing here that the purpose is not to achieve a better resolution – an issue forbidden by the Shannon theorem – but rather to increase the number of samples per speckle cell. We do not use 0-padding, as the technique is prone to errors, especially on intensity histograms when no specific attention is paid on normalization and borders effects. Two main drawbacks appear clearly: i) the observed field size, with the same N, will be reduced and ii) the number of elementary scatterers will be also reduced in the aperture of the imaging lens, which could prevent to use the central limit theorem and then lead to non-Gaussian speckle patterns The first drawback is inherent with computing limitations, and the second one vanishes as soon as a few hundreds of scatterers are present in the pupil area. Nearly resolved speckle patterns are shown in Fig. 5, obtained with a reduced pupil in a ratio of 1/10 (i.e., 2δxνc=1/10) with respect to the full pupil of Fig. 2, and corresponding to an m factor tending towards 1.002. The number of scatterers is greater than 2000. A [0, 0.06] zoom, the full histogram and the PDF are shown on Fig. 5 b). The Gamma distribution, very close to the decreasing exponential, fits pretty well the intensity histogram, except at the origin due to quantization effects in the histogram computation. On Fig. 6, integrated speckle patterns have been simulated with a m parameter equal to 75. 0.05 0.01 1 1 ⎯ ▪▪▪ ⎯ ▪▪▪ 0.5 0 a) 0 1 b) Hist(IS) Γd 5 Figure 5: Simulated resolved speckle pattern in image plane a) intensity pattern; b) histogram and Γ distribution with m=1.002. Hist(IS) Γd 0.5 a) 0 0.4 1 b) 1.6 Figure 6: a) Simulated integrated speckle pattern in image plane b) histogram and Γ distribution with m=75. 3.3 Phase of the computed fields The standard FFT algorithms take the origin at the lower left corner of the input matrices. As long as intensity patterns are concerned, this choice has no consequences, since the square modulus of FT pairs are invariant by translation. When it comes to simulate speckle phase distributions, the translation property should be taken into account: a translation in the object space induces a linear phase change in the Fourier plane. We thus need to re-center the input field so as to obtain the right phase. x[k] and X[i] designating a FT pair, the translation of the input function by d=N/2 amounts to correct the phase of the transform by an exponential factor given by exp(jπiN): FT [ x( k − d )] = exp( − j 2π id ) X [i ] = exp( jπ iN ) X [i ] (7) In all the simulations of speckle phase distributions, we changed therefore the phase of every two pixels by π. 3.4 Simulation parameters The simulations were made on Matlab, and the computing time is typically a few seconds for simple speckle pattern simulation, including histogram and autocorrelation function plotting, a few tens of seconds to emphasize the phase singularities and several tens of seconds for longitudinal speckle patterns simulation with autocorrelation function for 512×512 matrix elements. To save time, we built a one-dimensional autocorrelation function. Computations are made with floating real numbers, and can be scaled and converted in 8-bits integers to simulate intensity quantization by the detector, and so, to emphasize saturation problems6. The retained optical parameters are: Φ=20 mm, λ=532 nm, f=200 mm. Our computer is equipped with a Pentium 4 2.8 GHz processor and 1 GB of RAM. 4. FURTHER RESULTS 4.1 Speckle phase simulation By computing a nearly resolved speckle pattern corresponding to m=1.001, we obtained the phase histogram of Fig. 7. 1 ⎯ 2π c) ⎯ Histogram of speckle phase ▪▪▪ Theoretical PDF 0 -π -π/2 0 π/2 π a) b) e) d) Figure 7: Simulation of the speckle phase distribution. a) uniform histogram; b) simulated phase pattern; c) & d) lines where the real and imaginary parts of the complex amplitude are below an arbitrary small threshold; e) phase singularities of the simulated speckle. The phase pattern is shown in Fig. 7 b). We can highlight the presence of phase singularities, points where the phase is indeterminate because of zeros of intensity. We multiplied the two binary maps c) & d) consisting in the real and imaginary parts of the computed amplitude Uf, both taken below an arbitrary low threshold. The threshold was chosen after several trials as being about 1% of the maximum absolute value of the real and imaginary parts, resulting in the lines of nearly zero amplitude shown in Figs. 7 c) & d). Some phase singularities are white circled in e). It can be seen, that walking around singularities make the phase go through a full 2π loop clockwise or counterclockwise as indicated by the arrows. 4.2 Longitudinal speckle and autocorrelation A speckle pattern along z-axis can be simulated by computing the speckle field in a series of defocused planes, before and beyond the image plane, using the defocused impulse response, Eq. (3), and concatenating one column of each image to obtain the desired pattern, Fig. 8. We recognize the cigar shape of the speckle grains. 1 1 0.75 0.75 0.5 0.5 40 Figure 8: Longitudinal simulation. 85 128 175 220 Figure 9: Longitudinal autocorrelation function of speckle intensity pattern. 0 64 128 192 256 Figure 10: Transversal autocorrelation function of speckle intensity pattern. We computed also the autocorrelation function of the intensity to estimate the dimensions of the correlation volume. Classically, these dimensions are given by the abscissa of the first zero of the autocorrelation functions, i.e. for the longitudinal, δl, and transversal, δt, dimensions by: δ l = 8λ ( 2 f ) 2 Φ 2 ; δ t = 1.22λ (2 f ) Φ (8) With the parameters of our simulated optical system, we found δt = 1.7 mm and δl = 13 µm, according to the autocorrelation functions plotted Figs. 9 and 10. Indeed, with sampling rates of 80 µm along z-axis and 0.58 µm in the image plane, we found respectively 21 and 22 pixels, representing the above values of δt and δl. 4.3 Partially developed speckle patterns 1 α=1 Contrast 0.8 0.6 0.4 0.2 α = 0.75 abscissa of the image plane α = 0.5 α = 0.25 α = 0.1 0 -1.6 -0.8 0 0.8 The speckle contrast is a statistical indicator of prime interest, as it can provide information about surface roughness parameters. We simulated partially developed speckle patterns, i.e. speckle obtained when the object phase is uniformly distributed in an interval shorter than [-π, π], unlike the hypothesis of Eq. (2), i.e. in intervals [-απ, απ], α∈[0.1, 1]. One known consequence is the appearance of a dip of contrast in the image plane13, 14, when the speckle contrast is plotted in a series of defocused planes along the z-axis. Our simulations give exactly this result, as shown in Fig. 11. Figure 11: Dip of contrast in the image plane for several phase PDF widths. 1.6 z-axis [mm] 5. CONCLUSION The linear model, computed by means of two FFTs, appears to be an excellent tool for modelling the complex amplitude of speckle fields in a very wide variety of conditions. ACKNOWLEDGEMENTS These simulations of speckle patterns have been developed in the framework of the project “Phase extraction of 3D speckle interferometry signals”, supported by the Swiss National Science Foundation. REFERENCES 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. H. Fujii, J. Uozumi, and T. Asakura, “Computer simulation study of image speckle patterns with relation to object surface profile”, J. Opt. Soc. Am., 66, 1222-1236, 1976. N. Shvartsman, I. Freund, “Speckle spots ride phase saddles sidesaddle”, Opt. Comm., 117, 228-234, 1995. H. Meng, W.L. Anderson, F. Hussain, and D.D. Liu, “Intrinsic speckle noise in in-line particle holography”, J. Opt. Soc. Am. A, 10, 2046-2058, 1993. A. Federico, G.H. Kaufmann, “Comparative study of wavelet thresholding methods for denoising electronic speckle pattern interferometry fringes”, Opt. Eng., 40, 2598-2604, 2001. H. Liu, G. Lu, S. Wu, S. Yin, and F.T.S. Yu, “Speckle-induced phase error in laser-based phase-shifting projected fringe profilometry”, J. Opt. Soc. Am. A, 16, 1484-1495, 1999. M. Lehmann, Statistical theory of two-wave speckle interferometry and its application to the optimization of deformation measurements, EPFL thesis, N° 1797, 1998. D.C. Ghiglia, M.D. Pritt, Two-dimensional phase unwrapping. Theory, algorithms, and software, John Wiley & Sons, Inc., 1998. E. Robin, V. Valle, and F. Brémand, “Phase demodulation method from a single fringe pattern based on correlation with a polynomial form”, Appl. Opt., 44, 7261-7269, 2005. D. Mas, J. Garcia, C. Ferreira, L. M. Bernardo, F. Marinho, “Fast algorithms for free-space diffraction patterns calculation”, Opt. Comm., 164, 233-245, 1999. J.W. Goodman, An introduction to Fourier Optics, 2nd Ed., MacGraw-Hill Book Company, New York, 1996. J.W. Goodman, “Statistical properties of laser speckle patterns”, Laser speckle and related phenomena, J.C. Dainty Ed., 9-75, Springer-Verlag, Berlin Heidelberg New York, 1975. K. Nakagawa, N. Nagamatsu, T. Asakura and Y. Shindo, “An effect of the extended detecting aperture on the contrast of monochromatic and white-light speckle”, J. Optics, 13, 147-153, 1982. J.W. Goodman, “Dependence of image speckle contrast on surface roughness”, Opt. Comm. 14, 324-327, 1975. E. Jakeman and W.T. Welford, “Speckle statistics in imaging systems”, Opt. Comm., 21, 72-79, 1977.