A scanner for obtaining and/or measuring a 3D geometry of a surface of an object includes a camera having an array of sensor elements, a first device for generating a probe light, a device for transmitting the probe light rays towards the object, a device for transmitting light rays returned from the object to the array of sensor elements, an optical system for imaging with a first depth of field on the camera the transmitted light rays, a device for varying the position of the focus plane on the object, a device for obtaining at least one image from said array of sensor elements, a device for determining the in-focus position(s) of sensor elements, and a device for transforming the in-focus data into 3D coordinates.