A method for the calibration of an optical device having a spatial optical modulator, said device comprising a light source point, an optical objective of large numerical aperture adapted to receive an incident beam and/or to collect an optical beam reflected by a sample, a camera placed in a plane that is optically conjugate to the focal plane of the objective and a spatial optical modulator placed on the optical beam upstream of the camera, said method comprises the following steps: a) placement of a reflective planar sample in the vicinity of the focal plane of the objective; b) application of a command of amplitude R i j on an element P i of the spatial optical modulator, in such a manner to modulate the optical beam incident and/or reflected on the sample; c) acquisition of an image of the intensity of the Point Spread Function, PSF, in a plane conjugate to the focal plane of the objective; d) modification of the relative axial distance between the objective and the reflecting sample by a known quantity Z; e) iteration, j, of the steps c) and d) for a plurality of relative axial distances between the sample and the focal plane of the objective; f) reconstruction of the amplitude and/or phase profile of the beam in a plane conjugate to the focal plane of the objective by a phase diversity algorithm for a value R i j of an element P i; g) iteration of the steps b) to f) for a plurality of amplitude values R i j for an element P i of the spatial optical modulator; h) determination of the influence function E i of an element P i on the amplitude profile A and/or phase profile φ of the beam from the profiles obtained at step f); i) iteration of the steps b) to h) for the different elements P i i=1,.., N of the spatial optical modulator; j) determination of the influence functions (E 1,... E N) of all the elements P 1,... P N of the spatial optical modulator on the amplitude profile A and/or phase profile φ of the beam. a) placement of a reflective planar sample in the vicinity of the focal plane of the objective; b) application of a command of amplitude R i j on an element P i of the spatial optical modulator, in such a manner to modulate the optical beam incident and/or reflected on the sample; c) acquisition of an image of the intensity of the Point Spread Function, PSF, in a plane conjugate to the focal plane of the objective; d) modification of the relative axial distance between the objective and the reflecting sample by a known quantity Z; e) iteration, j, of the steps c) and d) for a plurality of relative axial distances between the sample and the focal plane of the objective; f) reconstruction of the amplitude and/or phase profile of the beam in a plane conjugate to the focal plane of the objective by a phase diversity algorithm for a value R i j of an element P i; g) iteration of the steps b) to f) for a plurality of amplitude values R i j for an element P i of the spatial optical modulator; h) determination of the influence function E i of an element P i on the amplitude profile A and/or phase profile φ of the beam from the profiles obtained at step f); i) iteration of the steps b) to h) for the different elements P i i=1,.., N of the spatial optical modulator; j) determination of the influence functions (E 1,... E N) of all the elements P 1,... P N of the spatial optical modulator on the amplitude profile A and/or phase profile φ of the beam.