Systems and methods for detection of a surface material on optical components
A surface material on one or more optical components of an optical sensing system can be detected. In some embodiments, a method of detection includes generating a first image using the optical sensing system. In accordance with a determination that one or more criteria are satisfied, the one or more criteria including a criterion that is satisfied when a proportion of the first image having an intensity of light in a first intensity range is greater than a threshold, a surface material is detected on the first attachable lens.
1 . A method comprising:
at an electronic device including a display and an optical sensing system including one or more image sensors, wherein the optical sensing system is configured to receive a first attachable lens positioned between the one or more image sensors and an eye of a user:
capturing a first image using the one or more image sensors of the optical sensing system, the first image including one or more reflections from the first attachable lens; and
in accordance with a determination that one or more criteria are satisfied, detecting a surface material on the first attachable lens.
2 . The method of claim 1 , wherein capturing the first image using the optical sensing system comprises:
capturing a color image; and
converting the color image to a luminance image.
3 . The method of claim 1 , further comprising:
computing a histogram of luminance values in the first image; and
determining a proportion of the first image having an intensity of light in a first intensity range using the histogram.
4 . The method of claim 1 , further comprising selecting one or more sub-images from the first image, wherein:
the one or more criteria include a criterion that is satisfied when a proportion of the first image having an intensity of light in a first intensity range is greater than a threshold; and
the criterion that is satisfied when the proportion of the first image having the intensity of light in the first intensity range that is greater than the threshold comprises the proportion of the one or more sub-images having the intensity of light in the first intensity range is greater than the threshold.
5 . The method of claim 1 , further comprising, in accordance with a determination that one or more criteria are not satisfied, forgoing detecting the surface material on the first attachable lens.
6 . An electronic device, comprising:
a display;
an optical sensing system including one or more image sensors, wherein the optical sensing system is configured to receive a first attachable lens positioned between the one or more image sensors and an eye of a user;
one or more processors configured for:
capturing a first image using the one or more image sensors of the optical sensing system, the first image including one or more reflections from the first attachable lens; and
in accordance with a determination that one or more criteria are satisfied, detecting a surface material on the first attachable lens.
7 . The electronic device of claim 6 , wherein capturing the first image using the optical sensing system comprises:
capturing a color image; and
converting the color image to a luminance image.
8 . The electronic device of claim 7 , wherein converting the color image to the luminance image comprises using a weighted combination of a red component, a blue component, and a green component of the color image.
9 . The electronic device of claim 6 , wherein the one or more processors are further configured for:
computing a histogram of luminance values in the first image; and
determining a proportion of the first image having an intensity of light in a first intensity range using the histogram.
10 . The electronic device of claim 9 , wherein determining the proportion of the first image having the intensity of light in the first intensity range is greater than a threshold comprises:
computing a percentage of the luminance values that fall between a first value and a second value.
11 . The electronic device of claim 10 , wherein the first value is 5% to 15% of a total intensity range for images and the second value is 85% to 95% of the total intensity range for the images.
12 . The electronic device of claim 6 , wherein the surface material includes fog.
13 . The electronic device of claim 6 , wherein the first image comprises a luminance image.
14 . The electronic device of claim 6 , wherein:
the one or more criteria include a criterion that is satisfied when a proportion of the first image having an intensity of light in a first intensity range is greater than a threshold; and
the threshold is between 5% and 10%.
15 . The electronic device of claim 6 , wherein the one or more processors are further configured for:
generating a user notification when the surface material is detected on the first attachable lens.
16 . The electronic device of claim 6 , wherein the one or more processors are further configured for:
capturing the first image with a controlled light sequence from one or more light sources included in or attached to the optical sensing system.
17 . The electronic device of claim 6 , wherein the one or more processors are further configured for:
deactivating the display while capturing the first image.
18 . The electronic device of claim 6 , wherein the one or more processors are further configured for:
selecting one or more sub-images from the first image, wherein:
the one or more criteria include a criterion that is satisfied when a proportion of the first image having an intensity of light in a first intensity range is greater than a threshold; and
the criterion that is satisfied when the proportion of the first image having the intensity of light in the first intensity range that is greater than the threshold comprises the proportion of the one or more sub-images having the intensity of light in the first intensity range is greater than the threshold.
19 . The electronic device of claim 6 , wherein the one or more processors are further configured for, in accordance with a determination that one or more criteria are not satisfied, forgoing detecting the surface material on the first attachable lens.
20 . A non-transitory computer readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by one or more processors of an electronic device, cause the electronic device to:
capture a first image using one or more image sensors in an optical sensing system of the electronic device, wherein the optical sensing system is configured to receive a first attachable lens positioned between the one or more image sensors and an eye of a user, the first image including one or more reflections from the first attachable lens; and
in accordance with a determination that one or more criteria are satisfied, detect a surface material on the first attachable lens.