EyeTrackVR/EyeTrackApp/blink.py
Prohurtz e5469cf42c one euro filter in IBO
messing around in IBO
2023-04-22 17:41:57 -05:00

28 lines
767 B
Python

import numpy as np
def BLINK(self):
if self.blink_clear == True:
self.max_ints = []
self.max_int = 0
intensity = np.sum(self.current_image_gray_clean)
self.frames = self.frames + 1
if intensity > self.max_int:
self.max_int = intensity
if self.frames > 400: #TODO: test this number more (make it a setting??)
self.max_ints.append(self.max_int)
if intensity < self.min_int:
self.min_int = intensity
if len(self.max_ints) > 1:
if intensity > min(self.max_ints):
blinkvalue = 0.0
else:
blinkvalue = 0.7
try:
return blinkvalue
except:
return 0.7
# print(self.blinkvalue, self.max_int, self.min_int, self.frames, intensity)