From 5fa9b3a07c53d12e89676983aff4382751ed12f8 Mon Sep 17 00:00:00 2001 From: Prohurtz <48768484+RedHawk989@users.noreply.github.com> Date: Fri, 2 Jun 2023 16:14:54 -0500 Subject: [PATCH] remove debug print, fix IBO eye saves --- EyeTrackApp/eye_processor.py | 2 +- EyeTrackApp/intensity_based_openness.py | 20 +++++++++++++++++--- EyeTrackApp/ransac.py | 1 - 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/EyeTrackApp/eye_processor.py b/EyeTrackApp/eye_processor.py index a582f78..b62edce 100644 --- a/EyeTrackApp/eye_processor.py +++ b/EyeTrackApp/eye_processor.py @@ -136,7 +136,7 @@ class EyeProcessor: self.er_hsf = None self.er_hsrac = None self.er_daddy = None - self.ibo = IntensityBasedOpeness(eyeside=EyeLR.LEFT if self.eye_id is EyeId.LEFT else EyeLR.RIGHT if eye_id is EyeId.RIGHT else -1) + self.ibo = IntensityBasedOpeness(self.eye_id) self.roi_include_set = {"rotation_angle", "roi_window_x", "roi_window_y"} self.failed = 0 diff --git a/EyeTrackApp/intensity_based_openness.py b/EyeTrackApp/intensity_based_openness.py index 8f8c88a..e413bae 100644 --- a/EyeTrackApp/intensity_based_openness.py +++ b/EyeTrackApp/intensity_based_openness.py @@ -32,7 +32,13 @@ import cv2 from enums import EyeLR from one_euro_filter import OneEuroFilter from utils.img_utils import safe_crop +from enum import IntEnum +class EyeId(IntEnum): + RIGHT = 0 + LEFT = 1 + BOTH = 2 + SETTINGS = 3 import matplotlib.pyplot as plt #higher intensity means more closed/ more white/less pupil @@ -105,9 +111,17 @@ def newdata(frameshape): class IntensityBasedOpeness: - def __init__(self, eyeside: EyeLR): + def __init__(self, eye_id): # todo: It is necessary to consider whether the filename can be changed in the configuration file, etc. - self.imgfile = "IBO_LEFT.png" if eyeside is EyeLR.LEFT else "IBO_RIGHT.png" + if eye_id in [EyeId.LEFT]: + self.imgfile = "IBO_LEFT.png" + else: + pass + if eye_id in [EyeId.RIGHT]: + self.imgfile = "IBO_RIGHT.png" + else: + pass + # self.imgfile = "IBO_LEFT.png" if eyeside is EyeLR.LEFT else "IBO_RIGHT.png" # self.data[0, -1] = maxval, [1, -1] = rotation, [2, -1] = x, [3, -1] = y self.data = None self.lct = None @@ -230,7 +244,7 @@ class IntensityBasedOpeness: self.filterlist.append(intensity) if intensity >= np.percentile(self.filterlist, 99): # filter abnormally high values - print('filter, assume blink') + # print('filter, assume blink') intensity = self.maxval #self.tri_filter.append(intensity) diff --git a/EyeTrackApp/ransac.py b/EyeTrackApp/ransac.py index f05f3cc..0d99797 100644 --- a/EyeTrackApp/ransac.py +++ b/EyeTrackApp/ransac.py @@ -246,7 +246,6 @@ def RANSAC3D(self, hsrac_en): pass cx, cy, w, h, theta = ransac_data - print(int(cx), int(cy)) # print(cx, cy) #cxi, cyi, wi, hi = int(cx), int(cy), int(w), int(h)