mirror of
https://github.com/EyeTrackVR/EyeTrackVR.git
synced 2025-11-04 14:39:42 +08:00
save calib values (NOT FINISHED)
This commit is contained in:
parent
cca9536b0b
commit
cbd20fdac8
@ -19,6 +19,10 @@ class EyeTrackCameraConfig(BaseModel):
|
||||
capture_source: Union[int, str, None] = None
|
||||
gui_circular_crop: bool = False
|
||||
|
||||
calib_XMAX: int = None
|
||||
calib_XMIN: int = None
|
||||
calib_YMAX: int = None
|
||||
calib_YMIN: int = None
|
||||
|
||||
class EyeTrackSettingsConfig(BaseModel):
|
||||
gui_flip_x_axis_left: bool = False
|
||||
|
||||
@ -286,7 +286,7 @@ class EyeProcessor:
|
||||
self.thresh=self.current_image_gray.copy()
|
||||
self.rawx, self.rawy, self.eyeopen = self.er_daddy.run(self.current_image_gray)
|
||||
# Daddy also uses a one euro filter, so I'll have to use it twice, but I'm not going to think too much about it.
|
||||
self.out_x, self.out_y = cal_osc(self, self.rawx, self.rawy)
|
||||
self.out_x, self.out_y = cal.cal_osc(self, self.rawx, self.rawy)
|
||||
self.current_algorithm = InformationOrigin.DADDY
|
||||
|
||||
def HSRACM(self):
|
||||
@ -296,27 +296,27 @@ class EyeProcessor:
|
||||
if self.prev_x is None:
|
||||
self.prev_x = self.rawx
|
||||
self.prev_y = self.rawy
|
||||
self.out_x, self.out_y = cal_osc(self, self.rawx, self.rawy)
|
||||
self.out_x, self.out_y = cal.cal_osc(self, self.rawx, self.rawy)
|
||||
self.current_algorithm = InformationOrigin.HSRAC
|
||||
|
||||
def HSFM(self):
|
||||
# todo: added process to initialise er_hsf when resolution changes
|
||||
self.rawx, self.rawy, self.thresh = self.er_hsf.run(self.current_image_gray)
|
||||
self.eyeopen = self.ibo.intense(self.rawx, self.rawy, self.current_image_gray)
|
||||
self.out_x, self.out_y = cal_osc(self, self.rawx, self.rawy)
|
||||
self.out_x, self.out_y = cal.cal_osc(self, self.rawx, self.rawy)
|
||||
self.current_algorithm = InformationOrigin.HSF
|
||||
|
||||
def RANSAC3DM(self):
|
||||
current_image_gray_copy = self.current_image_gray.copy() # Duplicate before overwriting in RANSAC3D.
|
||||
self.rawx, self.rawy, self.thresh = RANSAC3D(self)
|
||||
self.eyeopen = self.ibo.intense(self.rawx, self.rawy, current_image_gray_copy)
|
||||
self.out_x, self.out_y = cal_osc(self, self.rawx, self.rawy)
|
||||
self.out_x, self.out_y = cal.cal_osc(self, self.rawx, self.rawy)
|
||||
self.current_algorithm = InformationOrigin.RANSAC
|
||||
|
||||
def BLOBM(self):
|
||||
self.rawx, self.rawy, self.thresh = BLOB(self)
|
||||
self.eyeopen = self.ibo.intense(self.rawx, self.rawy, self.current_image_gray)
|
||||
self.out_x, self.out_y = cal_osc(self, self.rawx, self.rawy)
|
||||
self.out_x, self.out_y = cal.cal_osc(self, self.rawx, self.rawy)
|
||||
self.current_algorithm = InformationOrigin.BLOB
|
||||
|
||||
|
||||
|
||||
@ -2,6 +2,8 @@ import sys
|
||||
from utils.misc_utils import PlaySound, SND_FILENAME, SND_ASYNC
|
||||
import numpy as np
|
||||
from enum import IntEnum
|
||||
from config import EyeTrackConfig
|
||||
from config import EyeTrackSettingsConfig
|
||||
|
||||
class EyeId(IntEnum):
|
||||
RIGHT = 0
|
||||
@ -9,7 +11,15 @@ class EyeId(IntEnum):
|
||||
BOTH = 2
|
||||
SETTINGS = 3
|
||||
|
||||
def cal_osc(self, cx, cy):
|
||||
|
||||
class cal():
|
||||
# main_config = EyeTrackConfig
|
||||
|
||||
# def __init__(self, main_config: EyeTrackSettingsConfig):
|
||||
# self.settings = main_config
|
||||
|
||||
def cal_osc(self, cx, cy):
|
||||
svs = False
|
||||
if self.eye_id == EyeId.RIGHT:
|
||||
flipx = self.settings.gui_flip_x_axis_right
|
||||
else:
|
||||
@ -18,6 +28,12 @@ def cal_osc(self, cx, cy):
|
||||
self.calibration_frame_counter = None
|
||||
self.xoff = cx
|
||||
self.yoff = cy
|
||||
self.config.calib_XMAX = self.xmax
|
||||
self.config.calib_YMAX = self.ymax
|
||||
self.config.calib_XMIN = self.xmin
|
||||
self.config.calib_YMIN = self.ymin
|
||||
svs = False
|
||||
# self.settings.save()
|
||||
PlaySound('Audio/compleated.wav', SND_FILENAME | SND_ASYNC)
|
||||
elif self.calibration_frame_counter != None:
|
||||
self.settings.gui_recenter_eyes = False
|
||||
@ -29,7 +45,17 @@ def cal_osc(self, cx, cy):
|
||||
self.ymax = cy
|
||||
if cy < self.ymin:
|
||||
self.ymin = cy
|
||||
|
||||
#self.config.calib_XMIN not None and self.config.calib_YMAX
|
||||
self.calibration_frame_counter -= 1
|
||||
|
||||
if not any(i == None for i in (self.config.calib_XMIN, self.config.calib_YMIN, self.config.calib_XMAX, self.config.calib_YMAX)) and not svs:
|
||||
self.xmax = self.config.calib_XMAX
|
||||
self.ymax = self.config.calib_YMAX
|
||||
self.xmin = self.config.calib_XMIN
|
||||
self.ymin = self.config.calib_YMIN
|
||||
svs = True
|
||||
|
||||
if self.settings.gui_recenter_eyes == True:
|
||||
self.xoff = cx
|
||||
self.yoff = cy
|
||||
|
||||
Loading…
Reference in New Issue
Block a user