This invention provides a contaminant-detecting apparatus having high selectivity and high sensitivity against a contaminant. A convey unit (2) conveys a product (1) to be tested in a predetermined convey direction. An X-ray source (3) radiates X-rays to the product to be tested which is being conveyed by the convey unit. An X-ray detector (4) detects the X-rays transmitted through the product to be tested, and has an X-ray detection unit with a predetermined detection unit width in a direction perpendicularly intersecting the predetermined convey direction. A storage unit (5) stores a two-dimensional distribution of X-ray intensity detected by the X-ray detector as a transmission image in units of pixels. An average calculation unit (7) performs a sum-of-product operation of a kernel, which is equal to or larger than 7 pixels x 7 pixels, 9 pixels x 9 pixels, or 11 pixels x 11 pixels, and equal to or smaller than (a pixel count corresponding to 1/2 the predetermined X-ray detection unit width) x (a pixel count corresponding to 1/2 the predetermined X-ray detection unit width), and includes a target pixel, in units of pixels of the transmission image stored in the storage unit by using a predetermined coefficient matrix, thereby calculating the weighted average over the kernel. A difference calculation unit (8) calculates the difference between the X-ray intensity of the target pixel of the transmission image stored in the storage unit and the weighted average over the kernel of the target pixel which is calculated by the difference calculation unit. A determination unit (9) compares the difference calculated by the difference calculation unit with predetermined criteria, thereby determining presence/absence of a contaminant in the product to be tested. IMAGE
展开▼