1. A method of error correction in structured light, comprising: receiving, via a receiver sensor, a structured light image of at least a portion of a composite code mask encoding a plurality of codewords, the image including an invalid codeword; detecting the invalid codeword; generating a plurality of candidate codewords based on the invalid codeword; selecting one of the plurality of candidate codewords to replace the invalid codeword; generating a depth map for an image of the scene based on the selected candidate codeword; generating a digital representation of a scene based on the depth map; and outputting the digital representation of the scene to an output device.