Skip to main content

Capture constraints and image quality

V3 adds a lighting-quality gate to the V2 face geometry checks. Capture starts only after the face passes distance, position, pose, and lighting validation.

Compare constraint versions​

VersionFace geometryLighting qualityUse case
V1Landmark validationNoCompatibility with existing V1 integrations.
V2Distance, position, and poseNoGeometry-only capture.
V3Distance, position, and poseYesRecommended for new native integrations.

Selecting V3 does not change the captured media format. It changes which frames are accepted and records v3 in the result metadata.

Enable V3​

val options = MBCaptureSessionOptions.Builder()
.captureConstrains(MBCaptureConstrains.V3)
.imageQualityLevel(MBImageQualityLevel.LEVEL_2)
.build()

The Android public API uses the spelling MBCaptureConstrains and captureConstrains.

Choose a quality level​

LevelStrictnessSuggested starting point
LEVEL_1Most permissiveDifficult or highly variable lighting environments.
LEVEL_2BalancedGeneral production testing.
LEVEL_3Strictest and defaultControlled capture environments.

imageQualityLevel has no effect when V1 or V2 is selected.

V3 evaluates four lighting characteristics:

  • overall brightness
  • luminance variance
  • underexposure
  • illumination uniformity across the face

A frame fails the lighting gate when at least two measures are below the selected level.

Read validation status​

For V2 and V3, implement MBBoundingBoxFaceValidatorListener:

override fun onValidating(
faceBoxStatus: MBFaceBoundingBoxStatus,
faceGeometry: MBFaceGeometryModel
) {
when {
faceBoxStatus.distanceError != null -> handle(faceBoxStatus.distanceError)
!faceBoxStatus.positionErrors.isNullOrEmpty() ->
handle(faceBoxStatus.positionErrors.first())
!faceBoxStatus.poseErrors.isNullOrEmpty() ->
handle(faceBoxStatus.poseErrors.first())
else -> handle(faceBoxStatus.imageQualityStatus)
}
}

MBFaceBoundingBoxStatus.isValid is true only when every active check passes.

Lighting statuses​

StatusUser action
CHECKINGWait while the SDK obtains a fresh lighting measurement.
VALIDNo lighting correction is required.
INSUFFICIENT_LIGHTMove to a brighter area or add frontal light.
UNEVEN_LIGHTINGUse more even light on both sides of the face.

For the predefined UI, enable faceStatusLabel(true) to let the SDK display this guidance. For a custom UI, convert these statuses into your own visible messages.