A new method is presented for inspection of patient setup in radiation therapy by automatic comparison of the patient position relative to the beam position in portal and simulator images. Quantification of patient-setup errors in terms of translation, rotation, and magnification is achieved by chamfer matching, a robust technique to match drawings and images, which is applied to both anatomy outlines and field edges. Applied to field edges, chamfer matching detects and visualizes deviations in field shape. Applied to anatomy outlines, the matching procedure quantifies and visualizes deviations in patient position relative to the radiation field. To test the method and to judge its feasibility, its behavior for four hundred different patient-setup deviations, which were simulated in four clinical images, was examined. These images show a top view of the pelvic region. The performance was measured in terms of accuracy and success rate for numerous cost functions and distance codings associated with the chamfer matching procedure. An average accuracy of 1.8 mm was found, a success rate of 90%, and an average overall computation time of 3 s on a 486 microcomputer. The whole analysis procedure is fast enough to allow on-line application.