1. Introduction
Computer-generated holography (CGH) has become an essential technique in modern applications, including optical trapping [
1,
2], optogenetics [
3,
4], microscopy [
5,
6], and holographic displays [
7,
8]. This is because CGH, when combined with modern spatial light modulator (SLM) setups, enables precise control of both the amplitude and phase of a light field in three-dimensional (3D) space.
Despite these advantages, current CGH applications still face significant limitations. High-quality CGH generation relies on computationally demanding iterative algorithms, which make real-time processing challenging in standard computing hardware. Additionally, for applications that use CGH in conjunction with SLMs, the characteristics of these devices must be considered when designing CGH methods.
SLMs are typically capable of either phase-only or amplitude-only modulation, with phase-only modulation being preferred due to its higher diffraction efficiency [
9]. As a result, CGH algorithms must encode target fields into phase-only holograms (POHs). However, no general exact solution exists for this, leading to the development of numerous POH generation algorithms tailored to different target field characteristics, accuracy requirements, and computational constraints.
One of the earliest approaches to generating phase holograms was the Gerchberg–Saxton (GS) algorithm [
9]. This iterative method determines the phase that connects the hologram and its Fourier plane by imposing an amplitude constraint on the hologram plane. A Fourier transform is then applied, and the resulting amplitude is replaced by the target amplitude. This process is repeated iteratively until a suitable approximation of the target amplitude is obtained in the Fourier domain. However, the basic GS algorithm is limited to generating Fourier holograms of two-dimensional (2D) amplitude objects and exhibits relatively low accuracy.
Numerous variants of the GS algorithm have been developed to extend the capabilities of the original method, including adaptations for Fresnel holograms [
10], multiplane scenes [
11], and improved convergence constraints [
12]. However, high-resolution and high-accuracy holograms often require significant computation time.
Another technique broadly used in CGH is error diffusion. Originally developed to reduce the quantization noise introduced by binarizing an amplitude-only or phase-only hologram, this method involves calculating the difference in value between a pixel before binarization and after the process. This difference in value, called error, is then distributed to the neighboring pixels using specific weight factors. This process is repeated for all pixels in the hologram. The result is a binary phase-only or amplitude-only hologram, capable of reproducing a scene with reduced binarization noise [
13]. This approach has certain limitations: since all pixels must be updated sequentially, the error diffusion computation can be very slow for high-resolution holograms. Moreover, while noise is reduced for low-frequency components, it remains significant in the high frequencies of the reconstruction, thereby limiting the effective bandwidth of the scene. Error diffusion is not restricted to hologram binarization and has been used to convert complex holograms into phase-only functions [
14] or to encode band-limited color scenes into a single-phase hologram [
15].
More recently, phase CGH methods based on stochastic gradient descent (SGD) [
16,
17,
18,
19] and other optimization techniques have attracted interest. These methods define a loss function to measure the similarity between the target field and the field generated by a POH and then optimize the hologram to minimize this loss function. Unlike GS-based methods, optimization approaches offer greater flexibility, enabling the generation of phase-only, amplitude-only, or complex-valued holograms. Loss functions can be customized to enhance the specific characteristics of the target field, thereby enabling their application in a wide range of scenarios [
20]. Additionally, unlike conventional GS, SGD approaches can be used to generate Fourier or Fresnel holograms of any type of scene, including 2D, 3D, or multiplane ones [
21]. However, these methods require computing the gradient of the loss function at each iteration, which can be computationally intensive. This often necessitates advanced mathematical techniques, such as Wirtinger calculus [
17], making SGD-based hologram generation even more demanding than GS-based methods and, therefore, unsuitable for real-time applications.
Due to the computational challenges of iterative methods like GS and SGD, there is increasing interest in non-iterative approaches for phase hologram generation. Although these methods generally offer reduced accuracy, they present a substantial advantage in terms of computational speed. One notable non-iterative approach is the double-phase hologram technique [
22]. This method encodes a complex field into two interleaved phase functions, enabling its reconstruction after suppressing unwanted diffraction orders. However, because the field is encoded into two interleaved phase functions, the effective resolution is halved, which limits the accuracy of the reconstructed field, particularly in experimental setups constrained by the limited resolution of available SLMs. Variants of double-phase holography have been proposed to optimize interleaving patterns [
23], to modify the definition of the two phases [
24], or to reduce noise by using the spatiotemporal interleaving of multiple phase functions instead of the conventional spatial-only interleaving of two phases [
25].
Another non-iterative method is phase tailoring, which involves selecting a phase function where, when combined with the target field, the resulting distribution approximates the desired phase hologram through an inverse transformation. One representative example is the use of random phase functions [
26,
27]. Although simple to implement, random phase methods introduce significant speckle noise, which reduces the hologram quality.
To address this limitation, patterned random phase techniques have been introduced [
28], in which a repeating random phase block is used to improve the reconstruction accuracy. However, this technique introduces undesirable artifacts due to the periodicity of the phase pattern. Another alternative is the use of quadratic phase functions [
29], which reduce speckle noise but may lead to ringing artifacts in the reconstructed field.
An improved strategy involves optimizing tailored phase functions using iterative methods. One such method is the optimized random phase (ORAP) approach, where an initial random phase is optimized for a specific resolution, target size, and illumination wavelength using the GS algorithm [
30]. Once optimized, the resulting ORAP can be reused to generate phase holograms for multiple target scenes without requiring further iterations. This leads to a substantial enhancement in hologram quality compared with unoptimized random phases. Extensions of this method have been proposed for Fresnel holograms and 3D objects [
31]. Similarly, quadratic phase functions optimized using iterative algorithms such as GS have also shown improved performance over their unoptimized counterparts [
32].
Despite these advancements, current phase tailoring methods rely on GS-based optimization, which may not be the most effective or flexible approach for optimizing random phase functions. In this context, the potential of SGD-based optimization for non-iterative hologram generation must be explored. Given the demonstrated versatility of SGD in CGH applications, this work aimed to determine whether optimizing random phase functions using SGD can produce phase holograms of comparable or superior quality to those generated using GS-optimized random phases while maintaining computational efficiency. To achieve this, we applied SGD to optimize random phases using four distinct loss functions based on widely used image quality metrics. The resulting holograms were compared with those generated via conventional GS-optimized random phases, evaluating both the reconstruction quality and computational efficiency. Finally, the numerical and experimental results are presented to validate the effectiveness of the proposed approach.
3. Results
To evaluate the numerical performance of the SGD-ORAP generation in comparison with the conventional GS-ORAP, the support size for ORAP generation was set to 1920 × 1080 pixels in both cases, with a hologram resolution of 3840 × 2160 and a pixel size of 3.74 μm. This support size was initially selected to ensure adequate separation without crosstalk between the hologram reconstruction, the DC term, and higher diffraction orders when multiplying the hologram with a phase grating in optical experiments using a phase SLM.
The original work in which the ORAP concept was introduced used 50 GS iterations for ORAP generation [
30]. Based on this number and to ensure the adequate optimization of the random phases, we employed 50 iterations of both GS and SGD in all tests, using the four loss functions described in the previous section to generate the ORAPs.
Figure 2 presents the initial random phase and the resulting optimized phases obtained using GS and SGD with the loss functions described in the previous section. It is noteworthy that the optimized phases obtained using GS and SGD for all tested loss functions exhibit a random-like structure, and the phase pattern resulting from the GS algorithm shows a clear difference outside the support area. This difference is due to the hard constraint imposed during the GS algorithm process, in which the amplitude in the reconstruction plane is replaced by the target support amplitude, as illustrated in
Figure 1. In the SGD approach, this constraint is enforced indirectly by the minimization of the loss function, resulting in no visual difference between the phase inside and outside the support area.
These ORAPs were then used to generate the phase-only holograms of the same 2D target amplitude. The resulting holograms were reconstructed, and their quality was evaluated by comparing them with the original target amplitude using the CC and PSNR metrics.
The results of this test are presented in
Figure 3. The phase-only hologram generated using an unoptimized random phase exhibited the lowest reconstruction quality, as indicated by the CC and PSNR metrics. In contrast, the hologram produced using the GS-based ORAP demonstrated a noticeable improvement in reconstruction quality. However, all the holograms generated using the SGD and different loss functions exhibited even higher quality, as measured by both metrics. The ORAP obtained with SGD and the
yielded the highest overall quality, followed by the
,
, and, finally, the
. Although the reconstruction from the hologram generated with SGD and the
function outperformed the GS-based ORAP, it exhibited reduced uniformity and dark regions near the image corners, particularly noticeable in the superior left corner.
To further analyze these results more effectively, a small region of interest (ROI) from each reconstruction in
Figure 3 was selected to calculate the speckle contrast (SC) [
35]. This analysis was relevant because the primary drawback of using random phases to generate phase-only holograms is the appearance of speckle noise in the reconstruction. The speckle contrast (SC) for an image
is defined as
where
represents the mean value of the image. The SC takes values ranging from 0, indicating the absence of speckles or intensity fluctuations in the region of interest, to 1, which corresponds to a fully developed speckle pattern. Thus, in this test, a lower SC indicated reduced speckle degradation within region of interest of the reconstruction.
Figure 4 displays the enlarged region of interest for each reconstruction from
Figure 3, along with the corresponding speckle contrast measurement for each case. Note that the unoptimized random phase reconstruction exhibited the highest level of speckle, with the speckle contrast nearly halved in the GS-ORAP case. Using SGD with all the loss functions, except for the CC loss function, resulted in an approximately 10% reduction in the SC compared with the GS-based result. As observed in
Figure 2, the SGD
approach showed the best result with the lowest overall SC, with a nearly identical value to that obtained using the SGD
. It is worth noting that, although the SGD
produced the lowest CC and PSNR among all SGD-tested loss functions in
Figure 3, it yielded a lower overall SC than the result obtained with the
. This suggests that
is less effective at preserving the overall contrast and structure of the original target amplitude but more effective at reducing speckle noise than the CC loss function.
We will now analyze how the reconstruction quality, as measured by the PSNR, CC, and SC for each tested method, related to the number of iterations used to obtain the ORAP.
Figure 5 presents the evolution of the reconstruction quality as a function of the number of ORAP optimization iterations using GS and SGD with different loss functions. The results indicate that SGD optimization with
,
, and
yielded faster and more significant improvements in the CC (
Figure 5a), PSNR (
Figure 5b), and SC (
Figure 5c) as the number of iterations applied to the optimization of the ORAP increased in comparison with GS. In contrast, the SGD with the
function exhibited an initial decline in both the CC and PSNR during the first iterations, followed by a gradual recovery. After approximately 20 iterations, its performance became comparable to that of GS. Regarding the speckle contrast (
Figure 5c), the
showed a trend nearly identical to that of GS, with only minor improvement observed after 20 iterations. For all the results presented in this work, 50 iterations were used for all the implemented methods to generate ORAPs. However, the results indicate that 20 iterations were sufficient to obtain an adequate ORAP with all the tested approaches, except in the case of SGD with
. For SGD with loss functions other than
, as well as for the GS algorithm, additional iterations yielded only marginal improvements in the reconstruction quality.
To obtain the ORAPs used for the results in
Figure 3,
Figure 4 and
Figure 5, an RTX 3080 GPU and an Intel i9 12900K CPU were used, taking advantage of the GPU-based computation capabilities implemented via the PyTorch 2.7.0 library in the Python 3.12 programming language.
Table 1 presents the computation times required to generate the ORAPs using the methods discussed in
Section 2.
Table 1 presents the computation time required to generate the ORAPs used in
Figure 3 and
Figure 4. As expected, the GS-based ORAP was the fastest to compute, requiring only 0.246 s, followed by SGD, using
,
, and
, with computation times ranging from 0.350 to 0.463 s. Notably, SGD with
incurred the highest computational cost at 1.614 s due to the added complexity of evaluating structural similarity. These results highlight a well-known limitation of SGD optimization: as the complexity of the loss function increases, so does the time required to compute the gradient. It is worth noting that ORAP generation needs to be performed only once, and the resulting ORAP can be reused to generate any number of holograms of objects with the same support size. The hologram generation from an ORAP only required 0.002 s for all the results shown in this work, validating the practicality of the method. According to the results presented up to this point, the increased computation time of SGD-based ORAPs was well-justified by their capability to enable an improved reconstruction quality.
We then proceeded to evaluate the main advantage of the ORAP method: its ability to generate phase-only holograms for different scenes without the need for additional iterative procedures. For this test, we applied the ORAPs used to obtain the results in
Figure 3 and
Figure 4 to several distinct amplitude targets of the same size and resolution.
Figure 6 illustrates the effect of the contrast of the amplitude target on the quality of numerical reconstructions using ORAPs generated with GS and SGD optimized via different loss functions. As shown, lower-contrast amplitude targets with smoother intensity variations (center and right columns) were reconstructed with a higher quality across all ORAP variants, as measured by both the CC and PSNR. However, it is important to note that the improvements achieved with SGD using
and
, which were evident in the lower-contrast amplitude targets, were not observed in the high-contrast amplitude target shown in the left column of
Figure 6 when compared with GS and SGD with
ORAPs.
Finally, we tested how the ORAPs generated with GS and SGD performed when using different support sizes. To achieve this, we generated ORAPs for different target support sizes using GS and SGD with the four previously discussed loss functions. The target support sizes ranged from 10% and 100% of the hologram size. Once all ORAPs were obtained for each method and support size, we used them to generate the hologram of the amplitude target of
Figure 3, scaled to the different support sizes used in the ORAP generation. The resulting holograms were then reconstructed, and we computed the CC and PSNR between the reconstructed amplitude and the scaled target amplitude in each case.
Figure 7 shows the results of this test. As the target support size increased from 10% to 100% of the hologram area, both the CC (
Figure 7a) and the PSNR (
Figure 7b) consistently decreased across all methods, indicating a degradation in the reconstruction quality with the increasing support size. Among the tested methods, the SGD-based approaches, particularly those optimized with
and
, achieved the highest reconstruction fidelity across the entire range of support sizes. All SGD implementations consistently outperformed the classical GS algorithm, especially within the 10% to 50% range, where the performance gap became more pronounced. However, the GS- and SGD-based approaches exhibited a similar performance when the support size equaled the full hologram size.
4. Experimental Results
We proceeded to experimentally reconstruct the holograms generated using the ORAPs from the previous section. To this end, we employed the holographic projection setup shown in
Figure 8.
The experimental setup was based on a GAEA-2 spatial light modulator (SLM), HOLOEYE Photonics AG, Berlin, Germany, whose resolution of matched the resolution of the generated holograms. This device had a pixel size of 3.74 μm. Prior to being displayed on the SLM, the holograms were multiplied by a phase grating to avoid superposition between the reconstructed objects and the undiffracted light. Illumination was provided by a FISBA READYBeam Ind 2 laser, FISBA AG, St. Gallen, Switzerland, emitting at a wavelength of 520 nm, with an output power of 30 mW. The laser was coupled to a 3 μm single-mode fiber. To convert the divergent output from the fiber into a collimated beam, a collimation system comprising an adjustable iris and a 400 mm focal length converging lens was employed. A second converging lens with a 20 cm focal length was used to perform the Fourier transform of the holograms. The reconstructions were recorded using a Canon EOS R8 camera, Canon, Tokyo, Japan, with a resolution of and a pixel size of 6 μm.
The experimental results from projecting the holograms generated in the previous section are shown in
Figure 9. It can be observed that the reconstruction quality was nearly identical across all methods, with only the result obtained using SGD with
showing a slight difference. This was manifested as darker regions near the corners of the reconstruction and a proportionally increased brightness at the center. To better evaluate the differences between the reconstructions obtained from the holograms generated using ORAPs with all the discussed methods, we selected a region of interest in the reconstructions of the object shown in the first row of
Figure 9 and computed the CC and PSNR with respect to the original object.
The results of this test are shown in
Figure 10. Despite the visual similarity across all reconstructions, the results show a consistent, slight improvement over the GS approach in both the CC and PSNR for ORAPs generated using SGD with all the loss functions, except for
, which exhibited lower CC and PSNR values than GS.
The overall similarity between the reconstructions obtained using SGD- and GS-optimized ORAPs may be attributed to the significant speckle noise introduced by the experimental setup. Contributing factors included pixel crosstalk in the SLM, particularly affecting holograms with near-random phase distributions, such as those generated using ORAPs, as well as aberrations introduced by the reconstruction lens. Nevertheless, the results confirm that SGD, with all the tested loss functions, is a viable alternative to the standard GS-ORAP approach. The flexibility provided by SGD through custom loss functions suggests its potential for further improvement. In particular, incorporating loss functions that account for the physical characteristics of the optical setup and light propagation [
36] may enable future implementations of SGD-ORAP to achieve superior experimental performance compared with GS-ORAP.
5. Discussion
The numerical results in
Figure 3 and
Figure 4 indicate that ORAPs optimized using SGD produced a superior reconstruction quality compared with GS-ORAPs, as evidenced by the higher CC and PSNR values and lower speckle contrast, particularly when the
and
loss functions were employed. Among the tested loss functions, SGD with MSE loss yielded the highest overall performance. Notably, all SGD-optimized ORAPs performed significantly better on low-contrast targets than the GS-ORAP, as shown in
Figure 5. This behavior is likely attributable to the similarity between these targets and the rectangular support function used during optimization. Importantly, while the initial generation of SGD-ORAPs incurred a modest additional computational cost, their reusability across diverse targets offered a compelling trade-off between reconstruction quality and computational efficiency. Additionally, although
Table 1 shows that ORAP generation using SGD with all the tested loss functions required slightly more computation time than GS for 50 iterations, the results in
Figure 5 indicate that 20 iterations or less for SGD were sufficient for all loss functions except
.
Figure 7 further demonstrates that SGD-ORAP led to holograms with improved reconstructions across all target support sizes compared with GS-ORAP. However, this improvement diminished as the support sizes increased. A possible explanation of this effect is that the area outside the support is not considered during the loss function evaluation. As the support becomes smaller, optimization becomes easier because there are more pixels outside the support that can be freely adjusted to minimize the loss within the support area.
Finally, the optical reconstructions shown in
Figure 9 and
Figure 10 reveal minimal visual differences between the optical reconstruction of holograms generated with ORAPs using GS and SGD across all the tested loss functions. However, a slight improvement in the CC and PSNR was observed when employing SGD. As noted in the previous section, the comparable quality across the methods in experimental reconstructions may stem from noise sources in the holographic projection setup, absent in the numerical simulations, that potentially mask the quality enhancements achieved by the proposed methods. Nevertheless, these findings confirm that the SGD-ORAP method is a viable approach to the non-iterative generation of holograms.
Compared with recent advances in non-iterative hologram generation, most of which rely on convolutional neural networks (CNNs), the ORAP concept shown in this work offers a more accessible and computationally efficient alternative. Advanced CNN-based strategies, such as camera-in-the-loop setups [
37], propagation error compensation [
38], and learned light transport [
36], can achieve a higher reconstruction quality than those reported in this work. However, CNN-based approaches require large datasets and a substantial training time. In contrast, ORAPs can be computed in under one second for most of the tested loss functions. Furthermore, CNNs typically demand significant memory to store trained parameters, which may limit their practicality in some scenarios. In ORAP-based holography, only the ORAP and the target amplitude need to be stored, often requiring less than 20 MB for high-resolution holograms such as those used in this work. The final hologram is then obtained through a simple multiplication followed by an inverse Fourier transform, enabling very fast hologram generation.
6. Conclusions
We proposed and evaluated for the first time, to the best of our knowledge, a non-iterative method for phase-only hologram generation, employing stochastic gradient descent (SGD) to optimize random phase functions. By minimizing loss functions based on common image quality metrics, specifically MSE, PSNR, CC, and SSIM, we generated optimized random phase masks (ORAPs) that can be reused across multiple target amplitudes with the same support size, enabling non-iterative hologram generation.
The numerical results show that the SGD method with all the tested loss functions presented an improved ORAP generation performance with a minimal computational cost compared with the GS algorithm. Furthermore, the experimental results show that the performance of SGD-ORAPs was nearly identical to that of GS-ORAP across all four evaluated loss functions. These findings confirm that SGD is a viable approach for non-iterative hologram generation based on ORAPs. Moreover, SGD expands the design space through customizable loss functions, making it a promising alternative to conventional GS-based phase-tailoring methods.
Future research could explore improvements in reconstruction quality through alternative loss functions tailored to the spectral properties of target amplitude distributions or the specific characteristics of experimental setups. Additionally, combining multiple image quality metrics into a unified loss function, or extending this approach to patterned or quadratic random phases, may further enhance the quality of phase-only holograms. Finally, the added flexibility of SGD over the GS algorithm implies that the random phase optimization presented in this work could also be applied to obtain optimized phase functions for the generation of Fresnel holograms representing a broader range of scenes beyond 2D objects.