I. Introduction
Casting defect simulation techniques have received increasing attention in the field of automatic casting inspection [3], [4], [11], [13] to validate the system's sensitivity and to help tune the automatic inspection parameters. Automatic inspection and analysis of casting defects is one of the most important approaches to increasing casting quality. The extraction of the precise shape of the defect is a critical problem which strongly influences the effectiveness of automatic inspection systems [22]. The correct choosing and tuning of the parameters of the inspection algorithm is essential for it to be unaffected by changes across the casting image and is one of the most important steps to guaranteeing the efficiency of the inspection algorithm. The algorithms built for different kinds of casting products vary to some extent, but the tuning of their parameters is a common problem which can be complicated and involves a variety of aspects including consideration of the shapes of the casting defects, the contrast between defects and their background, and the structure of the casting pieces. Before implementing the program to inspect the work pieces, a large number of sample images are needed to tune the algorithm, examine its performance [23], and ensure its accuracy. Product images with defects from the production line are the best; however, they are often not available in sufficient quantities or variety. Simulation of casting defects is an alternative approach to deal with this problem.