Create an inSight instance:
InSight insight( "path/to/data/" );
First of all inSight must be initialized using a frame which contains the users face in frontal position, and with a neutral expression:
insight->init( frame );
Following the initialization, insight must process each consecutive frame of the video. So the process function must be called on each following frame:
insight->process( frame );
A calibration sequence starts after a process call by adding the first calibration point:
insight->addCalibrationPoint( calibrationPoint, outCalibInfo );
Here, the calibrationPoint is the point on the screen that the user is currently looking at. This procedure is repeated several times, until enough
calibration points are added. It is advised to collect at least nine calibration points. Additionally, it is a good practice to accumulate CalibInfo
structures produced by addCalibrationPoint in a vector. Let's take a closer look at CalibInfo members:
A CalibInfo object contains the following useful information:
- mScreenPos - Calibration point coordinates on screen plane
- mLeftEyePos & mRightEyePos - Left and right eye centers relative to their respective patch images.
- mLeftEyePatch & mRightEyePatch - Left and right eye patch images
The collection of CalibInfo structures is generally used as the input for inSight gaze calibration. To obtain good calibration it is important that this collection is
as accurate as possible. By visualizing the detected eye centers (mLeftEyePos & mRightEyePos) in their respective image patches (mLeftEyePatch & mRightEyePatch), one can see how good a CalibInfostructure is. Generally, the eye center will be visually off the actual eye center in bad CalibInfo structures.
Once the collection is considered to be good, we can finalize the inSight calibration procedure by calling the calibrate function:
insight->calibrate( inCalibInfoCollection, outReprojectionErrors );
The outReprojectionErrors vector, will depict the gaze estimation on each CalibInfo object. The magnitude of errors can provide a hint towards the quality of calibration result. Generally, although not always, lower errors represent a better calibration.
In case of a bad result, it is possible to repeat the calibration procedure starting from the addCalibrationPoint step (It is not required to initialize inSight again).