Computer-generated hologram(CGH) can encode the picture. The image, which equals the original object of traditional optics, can be divided into two parts. A portion of it encoding into Fourier computer generated hologram(CGH), while the remaining are coded into Fresnel computer generated hologram. So in the processing of information transmission, the possibility of being stolen details can be greatly reduced. When the image is coded into the Fourier CGH and Fresnel CGH and reached the receiving end, the original image should be obtained by the reconstruction of the two computer generated holograms. This article presents three important things. Firstly, it provides the recording and reconstruction - both of them consist of the holographic technique - of the source program of Fresnel CGH and Fourier CGH in MATLAB. MATLAB(Matrix Laboratory) is the abbreviation of Laboratory Matrix and commercial mathematical software produced by the United States company. Secondly, it isolates the original image and the conjugate image in regeneration of Fourier CGH by using all zero matrix. Even though the original image and the conjugate image can be separated, the two of them also prevent us to acquire the original message. For reserving the most important image, we should apply the window function to filter one of them. Finally, in the coding of Fourier CGH and Fresnel CGH, this passage describes several functions to decrease the noise of the original image which is encoded into program. The function can be available in Fourier CGH and Fresnel CGH.