Getting the best shot with faces with occluded eyes#
LUNA ID allows you control whether an image with occluded eyes can be considered the best shot. Occlusion can be caused by glasses, both eyeglasses and sunglasses.
The behavior differs between the Android and iOS platforms. Follow the platform-specific instructions below.
In LUNA ID for Android#
To enable getting the best shot with faces wearing glasses:
1․ Add the dependency
Include the glasses estimation module in your build.gradle file:
implementation("ai.visionlabs.lunaid:glasses:X.X.X@aar")
2․ Configure glassesCheck
The glassesChecks parameter in LunaConfig defines the type of glasses are allowed in best shot candidates. It accepts a set of GlassesCheckType values:
| Value | Description |
|---|---|
GlassesCheckType.GLASSES_CHECK_SUN |
Excludes images with sunglasses from best shots candidates. |
GlassesCheckType.GLASSES_CHECK_DIOPTER |
Excludes images with eyeglasses from best shots candidates. |
| Empty set | Default. All images with glasses are allowed as best shots. |
You can specify one, both, or none of these values.
The example below excludes both sunglasses and eyeglasses:
lunaConfig = LunaConfig.create(
glassesChecks = setOf(
GlassesCheckType.GLASSES_CHECK_SUN,
GlassesCheckType.GLASSES_CHECK_DIOPTER
)
)
3․ Optional. Enhance sunglasses detection
Specify the LunaConfig.advancedSunglasses parameter to increase sensitivity to sunglasses and reduce misclassification between regular glasses and sunglasses.
The advancedSunglasses parameter applies alternative internal thresholds that make the glasses estimator more sensitive to sunglasses.
Possible values:
| Value | Description |
| Value | Description |
| --- | --- |
| true | Applies enhanced sensitivity thresholds for glasses estimation. |
| false | Default. Applies standard sensitivity thresholds for glasses estimation. |
In LUNA ID for iOS#
1․ Enable glasses estimation
Set the LCLunaConfiguration.glassesCheckEnabled property to true. The default value is false. This will enable the glasses estimation. Only images that contain faces in eyeglasses will be considered best shots.
2․ Optional. Enhance sunglasses detection
Specify the LCLunaConfiguration.advancedSunglasses to increase sensitivity to sunglasses and reduce misclassification between regular glasses and sunglasses.
Possible values:
| Value | Description |
|---|---|
true |
Prohibits getting best shots with transparent sunglasses. |
false |
Default. Allows getting best shots with transparent sunglasses. |