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 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 and second detector elements configured to capture a second, color image of the object by receiving polychromatic optical radiation, wherein the first and second detector elements are configured to output first and second image signals responsively to the first and second 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.