## 2 Method for Automatic Optimization of the DOPC System  
Digital optical phase conjugation (DOPC) is known to be able to time-reverse the scattering process and compensate for wavefront distortions. In the absence of absorption, the time-reversal signal can be explained with the reciprocity theorem [7,39] in the spatial frequency domain, assuming the initial input field is \(E_{1}\big{(}k_{x},k_{y}\big{)}\). After transmission through the scattering medium and the optical system, the initial output field \(E_{2}\big{(}k_{x},k_{y}\big{)}\) can be written as  
\[E_{2}\big{(}k_{x},k_{y}\big{)}=\int E_{1}\big{(}k_{x},k_{y}\big{)}H\big{(}k_{x },k_{y},k_{x},k_{y}\big{)}dk_{x}dk_{y}, \tag{1}\]  
where \(H\big{(}k_{x},k_{y},k_{x},k_{y}^{\prime}\big{)}\) is a transfer function from the input mode \(\big{(}k_{x},k_{y}\big{)}\) to the transmission mode \(\big{(}k_{x},k_{y}\big{)}\). \(E_{2}\big{(}k_{x},k_{y}^{\prime}\big{)}\) interferes with the reference beam and the interference pattern is recorded by CCD, from which the conjugate phase \(\varphi_{0}\) is obtained. After adding it to the SLM, the conjugate beam \(E_{2}\big{(}k_{x},k_{y}\big{)}\) is propagated back to the transmission through scattering medium and the optical system; the field can be written as  
\[E_{1}{}^{\prime}\big{(}k_{x},k_{y}\big{)}=\int E_{2}{}^{*}\big{(}k_{x},k_{y}^{ \prime}\big{)}H^{\prime}\big{(}k_{x},k_{y}^{\prime},k_{x},k_{y}\big{)}dk_{x} {}^{\prime}dk_{y}{}^{\prime}, \tag{2}\]  
where \(H^{\prime}\big{(}k_{x},k_{y}^{\prime},k_{x},k_{y}\big{)}\) is a transfer function from the input mode \(\big{(}k_{x},k_{y}\big{)}\) to the transmission mode \(\big{(}k_{x},k_{y}\big{)}\). According to the reciprocity theorem, for stationary media, it can be known that \(H^{\prime}\big{(}k_{x},k_{y}^{\prime},k_{x},k_{y}\big{)}=H\big{(}k_{x},k_{y}, k_{x}^{\prime},k_{y}\big{)}\). As a result of Equations (1) and (2), it is concluded that \(E_{1}{}^{\prime}\big{(}k_{x},k_{y}\big{)}=E_{1}{}^{*}\big{(}k_{x},k_{y}\big{)}\) in an ideal situation of DOPC, where \({}^{*}\) denotes a conjugated phase. The direction of \(E_{1}{}^{\prime}\) is opposite to that of \(E_{1}{}\). However, it is not exactly equal in practical experiments because the actual compensation quality of DOPC is limited by pixel alignments, optical aberrations, and mechanical errors of the DOPC system. By focusing through a scattering medium, the focal spot obtained by DOPC compensation is not equal to the target focus without a scattering medium. For comprehensively solving the above problems and further improving the compensation effect, we introduce Zernike modes characterized by Zernike polynomials to compensate for the overall imperfections in the DOPC system. Here, we assume the amplitude of plane wave \(E_{2}{}^{*}\big{(}k_{x}^{\prime},k_{y}\big{)}\) is \(1\), and its conjugate phase \(\varphi_{0}\) is obtained by phase shift holography [40]. With Zernike modes, the optimal compensation phase \(\varphi_{0}+\varphi_{2 ernike}\) is added into the SLM after reverse transmission through a scattering medium; the optimized field \(E_{1}{}^{\prime}\big{(}k_{x},k_{y}\big{)}\) can be written as Equation (3). Additionally, the final optimized focused field \(E_{f1}{}^{\prime}\big{(}k_{x},k_{y}\big{)}\) can be written as Equation (4).