Skip to content

Image Validity

While the basic instruction for taking a measurement is simple—just look at the camera and start the measurement—there are a few guidelines that the user must follow to ensure accurate measurement results. These guidelines are listed in Binah.ai's best practices for taking a measurement.

During the measurement, the SDK assists the user in following these guidelines. It validates each camera image and updates the imageValidity with any detected deviations from the guidelines.

An image is considered valid if the SDK can use it to process and calculate vital sign results. Otherwise, the SDK reports the reason for invalidating the image.

If a sequence of invalid images lasts for more than 0.5 seconds or if the device fails to process images at the required frequency, the SDK notifies the application about the significant gap in image processing. This may cause a delay in the appearance of vital signs, affecting the confidence and expected accuracy of the results.

If a sequence of invalid images occurs for a third time during the measurement, lasting for more than 0.5 seconds, the SDK throws an error, and the session stops.

The conditions in the table below will invalidate the image for processing by the SDK.

NameMeaning
validThe image is valid.
invalidDeviceOrientationThe device orientation is unsupported for the session.
invalidRoiThe SDK cannot detect the user's face or finger.
tiltedHeadThe user's face is not facing directly towards the camera.
faceTooFarThe user's face is positioned too far from the camera. Instruct the user to hold the camera closer to their face.
unevenLightThe light on the user's face is not evenly distributed.

Image validity verification is reported as part of onImage as part of ImageListener:

Swift
func onImage(imageData: ImageData) {
    DispatchQueue.main.async {
        switch (imageData.imageValidity) {
            case ImageValidity.valid:
                // Valid
            case ImageValidity.invalidDeviceOrientation:
                // Invalid device orientation
            case ImageValidity.invalidRoi:
                // Invalid ROI
            case ImageValidity.tiltedHead:
                // Tilted Head
            case ImageValidity.faceTooFar:
                // Face Too Far
            case ImageValidity.unevenLight:
                // Uneven Light
        }
    }
}
func onImage(imageData: ImageData) {
    DispatchQueue.main.async {
        switch (imageData.imageValidity) {
            case ImageValidity.valid:
                // Valid
            case ImageValidity.invalidDeviceOrientation:
                // Invalid device orientation
            case ImageValidity.invalidRoi:
                // Invalid ROI
            case ImageValidity.tiltedHead:
                // Tilted Head
            case ImageValidity.faceTooFar:
                // Face Too Far
            case ImageValidity.unevenLight:
                // Uneven Light
        }
    }
}
Objective-c
- (void)onImageWithImageData:(BNHImageData *)imageData {
    dispatch_async(dispatch_get_main_queue(), ^{
        NSInteger imageValidity = imageData.imageValidity;
        if (imageValidity == BNHImageValidity.valid) {
            // Valid
        }
        else if (imageValidity == BNHImageValidity.invalidDeviceOrientation) {
            // Invalid device orientation
        }
        else if (imageValidity == BNHImageValidity.invalidRoi) {
            // Invalid ROI
        }
        else if (imageValidity == BNHImageValidity.tiltedHead) {
            // Tilted Head
        }
        else if (imageValidity == BNHImageValidity.faceTooFar) {
            // Face Too Far
        }
        else if (imageValidity == BNHImageValidity.unevenLight) {
            // Uneven Light
        }
    });
}
- (void)onImageWithImageData:(BNHImageData *)imageData {
    dispatch_async(dispatch_get_main_queue(), ^{
        NSInteger imageValidity = imageData.imageValidity;
        if (imageValidity == BNHImageValidity.valid) {
            // Valid
        }
        else if (imageValidity == BNHImageValidity.invalidDeviceOrientation) {
            // Invalid device orientation
        }
        else if (imageValidity == BNHImageValidity.invalidRoi) {
            // Invalid ROI
        }
        else if (imageValidity == BNHImageValidity.tiltedHead) {
            // Tilted Head
        }
        else if (imageValidity == BNHImageValidity.faceTooFar) {
            // Face Too Far
        }
        else if (imageValidity == BNHImageValidity.unevenLight) {
            // Uneven Light
        }
    });
}

Note

It is possible that an image is not valid due to several reasons. For example, when a user is too far and the light is not evenly distributed on his face.