An otoscope may project a temporal sequence of phase-shifted fringe patterns onto an eardrum, while a camera in the otoscope captures images. A computer may calculate a global component of these images. Based on this global component, the computer may output an image of the middle ear and eardrum. This image may show middle ear structures, such as the stapes and incus. Thus, the otoscope may “see through” the eardrum to visualize the middle ear. The otoscope may project another temporal sequence of phase-shifted fringe patterns onto the eardrum, while the camera captures additional images. The computer may subtract a fraction of the global component from each of these additional images. Based on the resulting direct-component images, the computer may calculate a 3D map of the eardrum.