This paper presents a technique for the detection and analysis of the surface characterization of foam patterns used in the lost foam casting process. The number of gaps (defects) among the beads on the pattern surface is used as the quality estimator, since the surface defects are the main cause of micro fatigue cracks in castings. The foam patterns images obtained have poor contrast and contain different objects other than the defects. The proposed image processing and analysis technique consists of three stages. The first stage is enhancement step to remove the undesirable illumination variations by using the bottom-hat filter. In the second stage, morphological operators and multilevel thresholding segmentation technique are applied to detect and segment regions of interest on the surface of the foam pattern. The last step is feature extraction and quantitative analysis. The classification process is done according to the area of the surface defects. All the recognized objects are divided into groups based on the minimum and the maximum defects area. The ratio between the total area in each group and the total surface area of the foam pattern is calculated and presented as a surface quality measure of the foam pattern. Experimental results carried out on different patterns demonstrate that the proposed method is a reliable and accurate technique for detecting the surface defects of the foam pattern.