A method for illuminating a user in an image captured by a camera on a device, comprising: assessing a distance between a user and a camera located on a device, the device comprising a computer processor and a memory, wherein the distance is assessed by: capturing at least one flood image using the camera located on the device, wherein the at least one flood image comprises an image captured while illuminating with flood infrared illumination from a flood illuminator located on the device; determining whether a face of the user is present in the at least one flood image and in response to determining the user's face is present in the at least one flood image, assessing the distance between the user's face and the camera from the at least one flood image; determining whether the assessed distance is less than a threshold distance or greater than the threshold distance; illuminating the user with speckle pattern illumination from a speckle pattern illuminator located on the device, wherein: in response to the assessed distance being less than the threshold distance, the speckle pattern illumination has a first dot density; and in response to the assessed distance being greater than the threshold distance, the speckle pattern illumination has a second dot density, the second dot density being greater than the first dot density. assessing a distance between a user and a camera located on a device, the device comprising a computer processor and a memory, wherein the distance is assessed by: capturing at least one flood image using the camera located on the device, wherein the at least one flood image comprises an image captured while illuminating with flood infrared illumination from a flood illuminator located on the device; determining whether a face of the user is present in the at least one flood image and in response to determining the user's face is present in the at least one flood image, assessing the distance between the user's face and the camera from the at least one flood image; capturing at least one flood image using the camera located on the device, wherein the at least one flood image comprises an image captured while illuminating with flood infrared illumination from a flood illuminator located on the device; determining whether a face of the user is present in the at least one flood image and in response to determining the user's face is present in the at least one flood image, assessing the distance between the user's face and the camera from the at least one flood image; determining whether the assessed distance is less than a threshold distance or greater than the threshold distance; illuminating the user with speckle pattern illumination from a speckle pattern illuminator located on the device, wherein: in response to the assessed distance being less than the threshold distance, the speckle pattern illumination has a first dot density; and in response to the assessed distance being greater than the threshold distance, the speckle pattern illumination has a second dot density, the second dot density being greater than the first dot density. in response to the assessed distance being less than the threshold distance, the speckle pattern illumination has a first dot density; and in response to the assessed distance being greater than the threshold distance, the speckle pattern illumination has a second dot density, the second dot density being greater than the first dot density. <EOS>