Skip to content
On this page

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 frame 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 frame.

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 following are conditions that will invalidate the image for processing by the SDK:

  • Device Orientation - The device orientation is unsupported for the session.
  • Undetected Face/Finger - The SDK cannot detect the user's face or finger.
  • Tilted Head - The user's face is not facing directly towards the camera.
  • Face Too Far - The user's face is positioned too far from the camera. Instruct the user to hold the camera closer to their face.
  • Uneven Light - The 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
        }
    }
}
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
        }
    });
}