The invention discloses a slice processing method based on a complex background. The method comprises the following steps: converting a background image with uneven lighting through two-dimensional Fourier, and obtaining a frequency domain image; constructing a Gaussian low-pass filter, obtaining a picture after frequency filtering, and obtaining the frequency domain image; changing frequency of the Gaussian low-pass filter, cutting out different slice images after low-pass filtering, separating backgrounds and defects of the slice images, and completing slicing processing; for images of which the backgrounds and the defects of the slice images need to be further improved, carrying out scale stretching on filtered images after gray scale to obtain a frequency domain stretching image; performing threshold segmentation on the frequency domain stretching image, cutting out the slice images, completing background and defect separation of the slice images, and completing slice processing. The method has the beneficial effects that optimization is carried out from an algorithm, the cost of equipment is reduced, the development time period is shortened, and related defects and features are extracted from ato-be-detected object with a complex background through the algorithm, so that the method can be applied to different fields and is wide in applicability.