The work aims to detect the surface defects of ceramic tiles with patterns and similar background gray and crack gray during online packaging. A reasonable detection mechanism was designed, suitable software and hardware were selected and compositions of each module were designed. With respect to the problem that it was hard to extract the crack contour through various kinds of operators, after the preprocessing of adaptive morphology, the crack edges, patterns and some background information were extracted in the difference image method through the fusion of wavelet transform and morphology, and then the patterns and background areas hard to process were eliminated. The defect profile and corresponding parameters were successfully obtained. Through comparison, the misdetection rate was 0.02 and the detection rate was 0.05. The system has a higher accuracy and can meet needs.