The present application belongs to the field of
coherent diffraction imaging, and specifically discloses a method and
system for automatic focusing of
coherent diffraction imaging. The present application simulates multiple groups of samples to be tested at different positions through a near-field propagation model, performs
wavelet transformation on the simulated samples to be tested to obtain
wavelet coefficients, calculates
clarity based on the
wavelet coefficients, and uses the
clarity weights of all simulated samples to update the
axial distance to gradually approach the actual value of the
axial distance between the sample and the
detector, thereby achieving automatic focusing of
coherent diffraction imaging. The present application proposes for the first time the use of operators in the
frequency domain to calculate the
clarity of the reconstructed image. This method has higher axial contrast and
noise robustness, greatly improving the convergence speed, accuracy and robustness; through
wavelet transform, the detail components of the image in the horizontal, vertical and
diagonal directions are extracted in the
frequency domain to evaluate the clarity of the reconstructed image, and the weights of different directions can be flexibly adjusted, which has better generalization.