mirror of
https://github.com/EyeTrackVR/EyeTrackVR.git
synced 2025-11-04 14:39:42 +08:00
fix: cleanup
This commit is contained in:
parent
88f19d9645
commit
4a351b0c44
@ -31,15 +31,11 @@ LICENSE: GNU GPLv3
|
|||||||
import sys
|
import sys
|
||||||
import asyncio
|
import asyncio
|
||||||
import os
|
import os
|
||||||
|
|
||||||
os.environ["OMP_NUM_THREADS"] = "1"
|
|
||||||
sys.path.append(".")
|
|
||||||
from config import EyeTrackCameraConfig
|
from config import EyeTrackCameraConfig
|
||||||
from config import EyeTrackSettingsConfig
|
from config import EyeTrackSettingsConfig
|
||||||
from pye3d.camera import CameraModel
|
from pye3d.camera import CameraModel
|
||||||
from pye3d.detector_3d import Detector3D, DetectorMode
|
from pye3d.detector_3d import Detector3D, DetectorMode
|
||||||
import queue
|
import queue
|
||||||
from eye import EyeId
|
|
||||||
from osc_calibrate_filter import *
|
from osc_calibrate_filter import *
|
||||||
from daddy import External_Run_DADDY
|
from daddy import External_Run_DADDY
|
||||||
from leap import External_Run_LEAP
|
from leap import External_Run_LEAP
|
||||||
@ -53,7 +49,8 @@ from intensity_based_openness import *
|
|||||||
from ellipse_based_pupil_dilation import *
|
from ellipse_based_pupil_dilation import *
|
||||||
from AHSF import *
|
from AHSF import *
|
||||||
from osc.OSCMessage import OSCMessageType, OSCMessage
|
from osc.OSCMessage import OSCMessageType, OSCMessage
|
||||||
|
os.environ["OMP_NUM_THREADS"] = "1"
|
||||||
|
sys.path.append(".")
|
||||||
|
|
||||||
def run_once(f):
|
def run_once(f):
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
@ -224,15 +221,6 @@ class EyeProcessor:
|
|||||||
|
|
||||||
rotation_matrix = cv2.getRotationMatrix2D(img_center, self.config.rotation_angle, 1)
|
rotation_matrix = cv2.getRotationMatrix2D(img_center, self.config.rotation_angle, 1)
|
||||||
|
|
||||||
# rows, cols = self.current_image.shape[:2]
|
|
||||||
# rotation_matrix = cv2.getRotationMatrix2D((cols / 2, rows / 2), self.config.rotation_angle, 1)
|
|
||||||
# cos_theta = np.abs(rotation_matrix[0, 0])
|
|
||||||
# sin_theta = np.abs(rotation_matrix[0, 1])
|
|
||||||
# new_cols = int((cols * cos_theta) + (rows * sin_theta))
|
|
||||||
# new_rows = int((cols * sin_theta) + (rows * cos_theta))
|
|
||||||
# rotation_matrix[0, 2] += (new_cols - cols) / 2
|
|
||||||
# rotation_matrix[1, 2] += (new_rows - rows) / 2
|
|
||||||
|
|
||||||
matrix = np.matmul(rotation_matrix, crop_matrix)
|
matrix = np.matmul(rotation_matrix, crop_matrix)
|
||||||
self.current_image_white = cv2.warpAffine(
|
self.current_image_white = cv2.warpAffine(
|
||||||
self.current_image,
|
self.current_image,
|
||||||
@ -332,7 +320,6 @@ class EyeProcessor:
|
|||||||
if blink_vec >= 0.18:
|
if blink_vec >= 0.18:
|
||||||
# self.out_x = sum(self.prev_x_list) / len(self.prev_x_list)
|
# self.out_x = sum(self.prev_x_list) / len(self.prev_x_list)
|
||||||
self.out_y = sum(self.prev_y_list) / len(self.prev_y_list)
|
self.out_y = sum(self.prev_y_list) / len(self.prev_y_list)
|
||||||
# print('AVG', self.out_y, len(self.prev_y_list))
|
|
||||||
|
|
||||||
if self.settings.gui_pupil_dilation:
|
if self.settings.gui_pupil_dilation:
|
||||||
self.pupil_dilation = self.ebpd.intense(
|
self.pupil_dilation = self.ebpd.intense(
|
||||||
@ -363,11 +350,6 @@ class EyeProcessor:
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
# if self.settings.gui_RANSACBLINK and self.eyeopen == 0.0: why is this here
|
|
||||||
# pass
|
|
||||||
# else:
|
|
||||||
# self.eyeopen = 0.81
|
|
||||||
|
|
||||||
osc_message = OSCMessage(
|
osc_message = OSCMessage(
|
||||||
type=OSCMessageType.EYE_INFO,
|
type=OSCMessageType.EYE_INFO,
|
||||||
data=(
|
data=(
|
||||||
@ -398,8 +380,6 @@ class EyeProcessor:
|
|||||||
self.out_x, self.out_y, self.avg_velocity = cal.cal_osc(self, self.rawx, self.rawy, self.angle)
|
self.out_x, self.out_y, self.avg_velocity = cal.cal_osc(self, self.rawx, self.rawy, self.angle)
|
||||||
self.current_algorithm = EyeInfoOrigin.LEAP
|
self.current_algorithm = EyeInfoOrigin.LEAP
|
||||||
|
|
||||||
# print(self.eyeopen)
|
|
||||||
|
|
||||||
def DADDYM(self):
|
def DADDYM(self):
|
||||||
# todo: We should have a proper variable for drawing.
|
# todo: We should have a proper variable for drawing.
|
||||||
# self.thresh = self.current_image_gray.copy()
|
# self.thresh = self.current_image_gray.copy()
|
||||||
@ -445,12 +425,7 @@ class EyeProcessor:
|
|||||||
) = RANSAC3D(self, True)
|
) = RANSAC3D(self, True)
|
||||||
if self.settings.gui_RANSACBLINK: # might be redundant
|
if self.settings.gui_RANSACBLINK: # might be redundant
|
||||||
self.eyeopen = ranblink
|
self.eyeopen = ranblink
|
||||||
# print("RANBLINK", ranblink)
|
|
||||||
|
|
||||||
# print(self.radius)
|
|
||||||
# if self.prev_x is None:
|
|
||||||
# self.prev_x = self.rawx
|
|
||||||
# self.prev_y = self.rawy
|
|
||||||
self.out_x, self.out_y, self.avg_velocity = cal.cal_osc(self, self.rawx, self.rawy, self.angle)
|
self.out_x, self.out_y, self.avg_velocity = cal.cal_osc(self, self.rawx, self.rawy, self.angle)
|
||||||
self.current_algorithm = EyeInfoOrigin.HSRAC
|
self.current_algorithm = EyeInfoOrigin.HSRAC
|
||||||
|
|
||||||
@ -481,12 +456,7 @@ class EyeProcessor:
|
|||||||
) = RANSAC3D(self, True)
|
) = RANSAC3D(self, True)
|
||||||
if self.settings.gui_RANSACBLINK: # might be redundant
|
if self.settings.gui_RANSACBLINK: # might be redundant
|
||||||
self.eyeopen = ranblink
|
self.eyeopen = ranblink
|
||||||
# print("RANBLINK", ranblink)
|
|
||||||
|
|
||||||
# print(self.radius)
|
|
||||||
# if self.prev_x is None:
|
|
||||||
# self.prev_x = self.rawx
|
|
||||||
# self.prev_y = self.rawy
|
|
||||||
self.out_x, self.out_y, self.avg_velocity = cal.cal_osc(self, self.rawx, self.rawy, self.angle)
|
self.out_x, self.out_y, self.avg_velocity = cal.cal_osc(self, self.rawx, self.rawy, self.angle)
|
||||||
self.current_algorithm = EyeInfoOrigin.HSRAC
|
self.current_algorithm = EyeInfoOrigin.HSRAC
|
||||||
|
|
||||||
@ -615,8 +585,6 @@ class EyeProcessor:
|
|||||||
self.failed = 0 # we have reached last possible algo and it is disabled, move to first algo
|
self.failed = 0 # we have reached last possible algo and it is disabled, move to first algo
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
# Run the following somewhere
|
|
||||||
# self.daddy = External_Run_DADDY()
|
|
||||||
|
|
||||||
self.firstalgo = None
|
self.firstalgo = None
|
||||||
self.secondalgo = None
|
self.secondalgo = None
|
||||||
@ -631,8 +599,6 @@ class EyeProcessor:
|
|||||||
# clear HSF values when page is opened to correctly reflect setting changes
|
# clear HSF values when page is opened to correctly reflect setting changes
|
||||||
self.er_hsf = None
|
self.er_hsf = None
|
||||||
|
|
||||||
# algolist[self.settings.gui_HSFP] = self.HSFM
|
|
||||||
|
|
||||||
# set algo priorities
|
# set algo priorities
|
||||||
if self.settings.gui_AHSFRAC:
|
if self.settings.gui_AHSFRAC:
|
||||||
if self.er_ahsf is None:
|
if self.er_ahsf is None:
|
||||||
@ -723,11 +689,8 @@ class EyeProcessor:
|
|||||||
self.eigthalgo,
|
self.eigthalgo,
|
||||||
) = algolist
|
) = algolist
|
||||||
|
|
||||||
f = True
|
|
||||||
while True:
|
while True:
|
||||||
|
|
||||||
# f = True
|
|
||||||
# print(self.capture_queue_incoming.qsize())
|
|
||||||
# Check to make sure we haven't been requested to close
|
# Check to make sure we haven't been requested to close
|
||||||
if self.cancellation_event.is_set():
|
if self.cancellation_event.is_set():
|
||||||
print("\033[94m[INFO] Exiting Tracking thread\033[0m")
|
print("\033[94m[INFO] Exiting Tracking thread\033[0m")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user