An optical device comprises a light source and a detector, and also a sample holder, which is configured to fix an object in the optical path of light. A scanning optical unit is configured, for a multiplicity of scanning positions, in each case selectively to direct light incident from different angular ranges from the object onto the detector. On the basis of a three-dimensional light field represented by corresponding measurement data of the multiplicity of scanning positions, a spatially resolved imaging of the object is generated, said imaging comprising at least two images from different object planes of the object.