mirror of
https://github.com/EyeTrackVR/EyeTrackVR.git
synced 2025-11-04 14:39:42 +08:00
intensity dual eye & bug hunting
This commit is contained in:
parent
ac4447f0ba
commit
2624080d58
@ -242,7 +242,7 @@ class EyeProcessor:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def BLINKM(self):
|
def BLINKM(self):
|
||||||
self.blinkvalue = BLINK(self)
|
self.eyeoffx = BLINK(self)
|
||||||
|
|
||||||
|
|
||||||
def HSRACM(self):
|
def HSRACM(self):
|
||||||
@ -256,43 +256,43 @@ class EyeProcessor:
|
|||||||
# if (cx - self.prev_x) <= 45 and (cy - self.prev_y) <= 45 :
|
# if (cx - self.prev_x) <= 45 and (cy - self.prev_y) <= 45 :
|
||||||
# self.prev_x = cx
|
# self.prev_x = cx
|
||||||
# self.prev_y = cy
|
# self.prev_y = cy
|
||||||
eyeopen = intense(cx, cy, uncropframe)
|
self.eyeopen = intense(cx, cy, uncropframe)
|
||||||
out_x, out_y = cal_osc(self, cx, cy)
|
out_x, out_y = cal_osc(self, cx, cy)
|
||||||
|
|
||||||
if cx == 0:
|
if cx == 0:
|
||||||
self.output_images_and_update(thresh, EyeInformation(InformationOrigin.HSRAC, out_x, out_y, 0, eyeopen)) #update app
|
self.output_images_and_update(thresh, EyeInformation(InformationOrigin.HSRAC, out_x, out_y, 0, self.eyeopen)) #update app
|
||||||
else:
|
else:
|
||||||
|
|
||||||
self.output_images_and_update(thresh, EyeInformation(InformationOrigin.HSRAC, out_x, out_y, 0, eyeopen))
|
self.output_images_and_update(thresh, EyeInformation(InformationOrigin.HSRAC, out_x, out_y, 0, self.eyeopen))
|
||||||
# else:
|
# else:
|
||||||
# print("EYE MOVED TOO FAST")
|
# print("EYE MOVED TOO FAST")
|
||||||
# self.output_images_and_update(thresh, EyeInformation(InformationOrigin.HSRAC, 0, 0, 0, False))
|
# self.output_images_and_update(thresh, EyeInformation(InformationOrigin.HSRAC, 0, 0, 0, False))
|
||||||
def HSFM(self):
|
def HSFM(self):
|
||||||
cx, cy, frame = External_Run_HSF.HSFS(self)
|
cx, cy, frame = External_Run_HSF.HSFS(self)
|
||||||
eyeopen = intense(cx, cy, self.current_image_gray)
|
self.eyeopen = intense(cx, cy, self.current_image_gray)
|
||||||
out_x, out_y = cal_osc(self, cx, cy)
|
out_x, out_y = cal_osc(self, cx, cy)
|
||||||
if cx == 0:
|
if cx == 0:
|
||||||
self.output_images_and_update(frame, EyeInformation(InformationOrigin.HSF, out_x, out_y, 0, eyeopen)) #update app
|
self.output_images_and_update(frame, EyeInformation(InformationOrigin.HSF, out_x, out_y, 0, self.eyeopen)) #update app
|
||||||
else:
|
else:
|
||||||
self.output_images_and_update(frame, EyeInformation(InformationOrigin.HSF, out_x, out_y, 0, eyeopen))
|
self.output_images_and_update(frame, EyeInformation(InformationOrigin.HSF, out_x, out_y, 0, self.eyeopen))
|
||||||
|
|
||||||
def RANSAC3DM(self):
|
def RANSAC3DM(self):
|
||||||
cx, cy, thresh = RANSAC3D(self)
|
cx, cy, thresh = RANSAC3D(self)
|
||||||
eyeopen = intense(cx, cy, self.current_image_gray)
|
self.eyeopen = intense(cx, cy, self.current_image_gray)
|
||||||
out_x, out_y = cal_osc(self, cx, cy)
|
out_x, out_y = cal_osc(self, cx, cy)
|
||||||
if cx == 0:
|
if cx == 0:
|
||||||
self.output_images_and_update(thresh, EyeInformation(InformationOrigin.RANSAC, out_x, out_y, 0, eyeopen)) #update app
|
self.output_images_and_update(thresh, EyeInformation(InformationOrigin.RANSAC, out_x, out_y, 0, self.eyeopen)) #update app
|
||||||
else:
|
else:
|
||||||
self.output_images_and_update(thresh, EyeInformation(InformationOrigin.RANSAC, out_x, out_y, 0, eyeopen))
|
self.output_images_and_update(thresh, EyeInformation(InformationOrigin.RANSAC, out_x, out_y, 0, self.eyeopen))
|
||||||
|
|
||||||
def BLOBM(self):
|
def BLOBM(self):
|
||||||
cx, cy, thresh = BLOB(self)
|
cx, cy, thresh = BLOB(self)
|
||||||
eyeopen = intense(cx, cy, self.current_image_gray)
|
self.eyeopen = intense(cx, cy, self.current_image_gray)
|
||||||
out_x, out_y = cal_osc(self, cx, cy)
|
out_x, out_y = cal_osc(self, cx, cy)
|
||||||
if cx == 0:
|
if cx == 0:
|
||||||
self.output_images_and_update(thresh, EyeInformation(InformationOrigin.HSRAC, out_x, out_y, 0, eyeopen)) #update app
|
self.output_images_and_update(thresh, EyeInformation(InformationOrigin.HSRAC, out_x, out_y, 0, self.eyeopen)) #update app
|
||||||
else:
|
else:
|
||||||
self.output_images_and_update(thresh, EyeInformation(InformationOrigin.HSRAC, out_x, out_y, 0, eyeopen))
|
self.output_images_and_update(thresh, EyeInformation(InformationOrigin.HSRAC, out_x, out_y, 0, self.eyeopen))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,17 @@
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
from enum import IntEnum
|
||||||
#higher intensity means more closed/ more white/less pupil
|
#higher intensity means more closed/ more white/less pupil
|
||||||
|
|
||||||
#Hm I need an acronym for this, any ideas?
|
#Hm I need an acronym for this, any ideas?
|
||||||
#IBO Intensity Based Openess
|
#IBO Intensity Based Openess
|
||||||
|
class EyeId(IntEnum):
|
||||||
|
RIGHT = 0
|
||||||
|
LEFT = 1
|
||||||
|
BOTH = 2
|
||||||
|
SETTINGS = 3
|
||||||
|
|
||||||
# HOW THIS WORKS:
|
# HOW THIS WORKS:
|
||||||
# we get the intensity of pupil area from HSF crop, When the eyelid starts to close, the pupil starts being obstructed by skin which is generally lighter than the pupil.
|
# we get the intensity of pupil area from HSF crop, When the eyelid starts to close, the pupil starts being obstructed by skin which is generally lighter than the pupil.
|
||||||
@ -13,8 +19,14 @@ import time
|
|||||||
# ex. when you look up there is less pupil visible, which results in an uncalculated change in intensity even though the eyelid has not moved in a meaningful way.
|
# ex. when you look up there is less pupil visible, which results in an uncalculated change in intensity even though the eyelid has not moved in a meaningful way.
|
||||||
# We compare the darkest intensity of that area, to the lightest (global) intensity to find the appropriate openness state via a float.
|
# We compare the darkest intensity of that area, to the lightest (global) intensity to find the appropriate openness state via a float.
|
||||||
|
|
||||||
fname = "IBO.csv" #TODO Expose as setting
|
|
||||||
|
if EyeId.RIGHT:
|
||||||
|
fname = "IBO_RIGHT.csv"
|
||||||
|
if EyeId.LEFT:
|
||||||
|
fname = "IBO_LEFT.csv"
|
||||||
|
|
||||||
lct = time.time()
|
lct = time.time()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
data = pd.read_csv(fname, sep=",")
|
data = pd.read_csv(fname, sep=",")
|
||||||
except:
|
except:
|
||||||
@ -27,15 +39,18 @@ except:
|
|||||||
|
|
||||||
def intense(x, y, frame):
|
def intense(x, y, frame):
|
||||||
global lct
|
global lct
|
||||||
|
|
||||||
upper_x = int(x) + 25 #TODO make this a setting
|
upper_x = int(x) + 25 #TODO make this a setting
|
||||||
lower_x = int(x) - 25
|
lower_x = int(x) - 25
|
||||||
upper_y = int(y) + 25
|
upper_y = int(y) + 25
|
||||||
lower_y = int(y) - 25
|
lower_y = int(y) - 25
|
||||||
frame = frame[lower_y:upper_y, lower_x:upper_x]
|
frame = frame[lower_y:upper_y, lower_x:upper_x]
|
||||||
|
|
||||||
|
print(x, y, int(x), int(y), upper_x, upper_y, lower_x, lower_y)
|
||||||
try:
|
try:
|
||||||
xy = int(str(int(x)) + str(int(y)) + str(int(x)+int(y)))
|
xy = int(str(int(x)) + str(int(y)) + str(int(x)+int(y)))
|
||||||
intensity = np.sum(frame)
|
intensity = np.sum(frame) #why is this outputting 0s?
|
||||||
|
# print(intensity, upper_x, upper_y, lower_x, lower_y)
|
||||||
except:
|
except:
|
||||||
return 0.0 #TODO find how on earth a hyphen gets thrown into this
|
return 0.0 #TODO find how on earth a hyphen gets thrown into this
|
||||||
|
|
||||||
@ -78,9 +93,10 @@ def intense(x, y, frame):
|
|||||||
#eyeopen = (intensity - minp) / (maxp - minp)
|
#eyeopen = (intensity - minp) / (maxp - minp)
|
||||||
eyeopen = (intensity - maxp) / (minp - maxp)
|
eyeopen = (intensity - maxp) / (minp - maxp)
|
||||||
eyeopen = 1 - eyeopen
|
eyeopen = 1 - eyeopen
|
||||||
|
eyeopen = eyeopen - 0.2
|
||||||
# print(intensity, maxp, minp, x, y)
|
# print(intensity, maxp, minp, x, y)
|
||||||
print(f"EYEOPEN: {eyeopen}")
|
# print(f"EYEOPEN: {eyeopen}")
|
||||||
|
# print(int(x), int(y), eyeopen, maxp, minp)
|
||||||
|
|
||||||
except:
|
except:
|
||||||
print('[INFO] Something went wrong, assuming blink.')
|
print('[INFO] Something went wrong, assuming blink.')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user