The problem of the imaging through turbid medium such as fog, haze and human tissue has always been the focus of attention. The turbid medium destroys the wavefront of the incident beam, so the key to the recovery of the image is the reconstruction process of the wavefront. The spatial light modulator (SLM) is employed to reconstructs the wavefront digitally. In order to realize imaging through the turbid medium, a prior image is restored at the target location in the simulation, and the phase modulation of the SLM is obtained by the advanced genetic algorithm. Then the priori image is replaced with the new image to be restored. According to the optical memory effect, the new image can be imaging at the target location. The optical memory effect was tested using a series of circular spots of different sizes, and the results showed that the recovery ability gradually decreased with the increased image size. Finally, the curve of the cost function with the number of iterations in 7 different population is analyzed. The results show that the convergence value increases first and then stops with the increase of the group, and the convergence rate is not positively correlated with the group size. So choosing the right group size makes a lot of sense for image restoration.