antoinelame / GazeTracking

👀 Eye Tracking library easily implementable to your projects
MIT License
1.98k stars 528 forks source link

Automatic Calibration #31

Closed EderSant closed 4 years ago

EderSant commented 4 years ago

Hi @Antoinelame

I would like to know how I do it if I want to disable automatic calibration and use threshold values that I have informed. What should I do for this? I am having trouble with automatic calibration. I saw that @Blackhorse1988 made this change and was able to find a threshold value that would meet his need. I'm a little lost on how to do it.

antoinelame commented 4 years ago

Hello @EderSant,

The Calibration class tries to detect the best threshold for your eye. If you prefer to pass your own value, you can directly override the threshold value in the _analyze() method of the Eye class.

If you do that, you can remove these lines:

if not calibration.is_complete():
            calibration.evaluate(self.frame, side)

Example:

def _analyze(self, original_frame, landmarks, side):
    # ...

    self.blinking = self._blinking_ratio(landmarks, points)
    self._isolate(original_frame, landmarks, points)

    self.pupil = Pupil(self.frame, YOUR_THRESHOLD_VALUE)