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 the 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 did not detect any violations to the best practices for taking a measurement. If the image is not considered valid the SDK reports the reason for invalidating the image.

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

NameMeaning
VALIDThe image is valid.
INVALID_DEVICE_ORIENTATIONThe device orientation is unsupported for the session.
INVALID_ROIThe SDK cannot detect the user's face.
TILTED_HEADThe user's face is not facing directly towards the camera.
FACE_TOO_FARCurrently not supported in Web
UNEVEN_LIGHTThe light on the user's face is not evenly distributed.

Image validity verification is reported as part of OnImageData callback interface:

TypeScript
import healthMonitorManager, { 
    FaceSessionOptions,
    ImageValidity
} from '@biosensesignal/web-sdk';

const onImageData = useCallback((imageValidity: ImageValidity) => {
let message: string;
if (imageValidity != ImageValidity.VALID) {
    switch (imageValidity) {
    case ImageValidity.INVALID_DEVICE_ORIENTATION:
        message = 'Unsupported Orientation';
        break;
    case ImageValidity.TILTED_HEAD:
        message = 'Head Tilted';
        break;
    case ImageValidity.FACE_TOO_FAR: // Placeholder, currently not supported
        message = 'You Are Too Far';
        break;
    case ImageValidity.UNEVEN_LIGHT:
        message = 'Uneven Lighting';
        break;
    case ImageValidity.INVALID_ROI:
    default:
        message = 'Face Not Detected';
    }
    console.log(`ImageValidity = ${message}`);
} 

const options: FaceSessionOptions = { 
    input: video.current,
    cameraDeviceId: cameraId,
    processingTime,
    onVitalSign,
    onFinalResults,
    onError,
    onWarning,
    onStateChange,
    onImageData 
};

const faceSession = await healthMonitorManager.createFaceSession(options); 

}, []);

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.