A technique for measuring the profile of the illumination in the pupil of a lithography projector is presented. The technique is based on exposing pinhole patterns on a wafer at different dose and defocus settings, and processing the scanning electron microscopy (SEM) images of the printed pinholes. The latent image intensity at the edges of the resist patterns equals the dose-to-clear. This establishes a multitude of equations, each of which states that the latent image intensity at a particular field location, dose, and defocus is known. The intensity distribution in the pupil of the illuminator is obtained by solving a large system of such equations, subject to the constraint that the intensity distribution is non-negative. An image processing algorithm based on nonlinear diffusion is used for finding coordinates of points on the edges of resist in SEM images. The results of the inversion for 193-nm stepper with 0.55/0.85 annular illumination and numerical aperture of 0.75 at five exposure field locations are presented.