A method of imaging an interior of an eye includes illuminating the interior of the eye with one or more beams of light from a light source, and said illuminating is configured to trigger a change to a pupil of the eye. An image sensor captures a sequence of images of light reflected by the interior of the eye during an expected timeframe when a width of the pupil is changing in response to said illuminating. A processing apparatus combines images in the sequence of images to form a composite image having a larger depth of field than a depth of field of each of the images in the sequence of images. The depth of field for each of the images corresponds to the width of the pupil when each of the images is captured.