1. Imaging apparatus, comprising: an illumination subassembly, which is configured to project onto an object a pattern of monochromatic optical radiation in a given wavelength band; an imaging subassembly comprising: an image sensor, which comprises an array of detector elements comprising (i) first detector elements configured to capture a first, monochromatic image of the pattern on the object by receiving the monochromatic optical radiation reflected from the object, (ii) second detector elements configured to capture a second, color image of the object by receiving polychromatic optical radiation, and (iii) third detector elements configured to capture a third image by receiving a wavelength band of monochromatic optical radiation that is offset from the given wavelength band, wherein the first, second, and third detector elements are configured to output first, second, and third image signals responsively to the first, second, and third images, respectively; and a switching circuit, configured to demultiplex the first and second image signals from the image sensor so as to simultaneously output the first and second signals in each of a sequence of frames; and a processor, which is configured to process the first and second signals so as to generate and output a depth map of the object in registration with the color image, wherein the processor is configured to subtract the third image signal from the first image signal in order to generate the depth map.