A method, operated by an image processing device, for generating a depth map, the method comprising: receiving an image, the image corresponding to a light field projected through a mask onto a scene, the mask comprising a point matrix pattern comprising an array of dots, each dot corresponding to a binary zero value or a binary one value according to whether or not the dot blocks light, wherein the received image includes a plurality of codewords, each codeword comprising an array of codeword bits (612, 614, 616), each codeword bit comprising an array of pixels in the image and corresponding to a dot of the point matrix pattern of the mask; detecting a plurality of codeword boundaries in the image, each codeword boundary corresponding to a particular codeword bit of a codeword, wherein each detected codeword boundary is constrained from overlapping with other detected codeword boundaries, such that no pixel of the image is associated with more than one codeword boundary, wherein detecting the codeword boundaries comprises selecting a pixel for each codeword bit of each codeword; identifying one or more codewords corresponding to the detected codeword boundaries by, for an identified codeword: i) determining a value of each codeword bit of the codeword based on the selected pixel for each codeword bit, and ii) associating the codeword with a known codeword projected as part of the projected light field; utilizing at least one disparity value between i) a location on the image of an identified codeword of the one or more identified codewords and ii) a location associated with the identified codeword on the projected light field to generate a disparity map; and generating a depth map based on the disparity map. receiving an image, the image corresponding to a light field projected through a mask onto a scene, the mask comprising a point matrix pattern comprising an array of dots, each dot corresponding to a binary zero value or a binary one value according to whether or not the dot blocks light, wherein the received image includes a plurality of codewords, each codeword comprising an array of codeword bits (612, 614, 616), each codeword bit comprising an array of pixels in the image and corresponding to a dot of the point matrix pattern of the mask; detecting a plurality of codeword boundaries in the image, each codeword boundary corresponding to a particular codeword bit of a codeword, wherein each detected codeword boundary is constrained from overlapping with other detected codeword boundaries, such that no pixel of the image is associated with more than one codeword boundary, wherein detecting the codeword boundaries comprises selecting a pixel for each codeword bit of each codeword; identifying one or more codewords corresponding to the detected codeword boundaries by, for an identified codeword: i) determining a value of each codeword bit of the codeword based on the selected pixel for each codeword bit, and ii) associating the codeword with a known codeword projected as part of the projected light field; utilizing at least one disparity value between i) a location on the image of an identified codeword of the one or more identified codewords and ii) a location associated with the identified codeword on the projected light field to generate a disparity map; and generating a depth map based on the disparity map.