An intraoral scanner for obtaining and/or measuring a 3D geometry of at least a part of a surface of a patient's set of teeth, said scanner comprising: - a first camera comprising an array of sensor elements, - a first means for generating a probe light, - means (250, 280) for transmitting the probe light rays towards the teeth thereby illuminating at least a part of the teeth, - means (250, 280) for transmitting light rays returned from the teeth to the array of sensor elements, - a first optical system for imaging with a first depth of field on the first camera at least part of the transmitted light rays returned from the teeth to the array of sensor elements, - means for varying the position of the focus plane on the teeth, - means for obtaining at least one image from said array of sensor elements, - means for determining the in-focus position(s) of: - each of a plurality of the sensor elements for a range of focus plane positions, or - each of a plurality of groups of the sensor elements for a range of focus plane positions, and - means for transforming the in-focus data into 3D coordinates; - means for selecting a portion of light rays returned from the teeth, where the light rays have been transmitted through at least a part of the first optical system; and - a second camera for capturing at least some of the selected light rays with a second depth of field, where the ratio between the second depth of field and the first depth of field is in the range of 10 to 2000; characterized in that the means for selecting a portion of light rays returned from the teeth is arranged in an aperture in the first optical system and the region of the aperture, where light rays is selected from, is less than 30% of the area of the aperture. - a first camera comprising an array of sensor elements, - a first means for generating a probe light, - means (250, 280) for transmitting the probe light rays towards the teeth thereby illuminating at least a part of the teeth, - means (250, 280) for transmitting light rays returned from the teeth to the array of sensor elements, - a first optical system for imaging with a first depth of field on the first camera at least part of the transmitted light rays returned from the teeth to the array of sensor elements, - means for varying the position of the focus plane on the teeth, - means for obtaining at least one image from said array of sensor elements, - means for determining the in-focus position(s) of: - each of a plurality of the sensor elements for a range of focus plane positions, or - each of a plurality of groups of the sensor elements for a range of focus plane positions, and - each of a plurality of the sensor elements for a range of focus plane positions, or - each of a plurality of groups of the sensor elements for a range of focus plane positions, and - means for transforming the in-focus data into 3D coordinates; - means for selecting a portion of light rays returned from the teeth, where the light rays have been transmitted through at least a part of the first optical system; and - a second camera for capturing at least some of the selected light rays with a second depth of field, where the ratio between the second depth of field and the first depth of field is in the range of 10 to 2000;