minor fixes/cleanup

This commit is contained in:
Prohurtz 2023-02-17 18:52:59 -06:00
parent c26c336a3e
commit ad0857f8eb
4 changed files with 41 additions and 30 deletions

View File

@ -357,14 +357,14 @@ class EyeProcessor:
_, self.firstalgo, self.secondalgo, self.thirdalgo, self.fourthalgo = algolist
# if self.settings.gui_HSF and self.settings.gui_HSFP == 1: #I feel like this is super innefficient though it only runs at startup and no solution is coming to me atm
# self.firstalgo = self.HSFM
# elif self.settings.gui_HSF and self.settings.gui_HSFP == 2:
# self.secondalgo = self.HSFM
# elif self.settings.gui_HSF and self.settings.gui_HSFP == 3:
# self.thirdalgo = self.HSFM
# elif self.settings.gui_HSF and self.settings.gui_HSFP == 4:
# self.fourthalgo = self.HSFM
if self.settings.gui_HSF and self.settings.gui_HSFP == 1: #I feel like this is super innefficient though it only runs at startup and no solution is coming to me atm
self.firstalgo = self.HSFM
elif self.settings.gui_HSF and self.settings.gui_HSFP == 2:
self.secondalgo = self.HSFM
elif self.settings.gui_HSF and self.settings.gui_HSFP == 3:
self.thirdalgo = self.HSFM
elif self.settings.gui_HSF and self.settings.gui_HSFP == 4:
self.fourthalgo = self.HSFM
if self.settings.gui_RANSAC3D and self.settings.gui_RANSAC3DP == 1:
self.firstalgo = self.RANSAC3DM
@ -375,14 +375,14 @@ class EyeProcessor:
elif self.settings.gui_RANSAC3D and self.settings.gui_RANSAC3DP == 4:
self.fourthalgo = self.RANSAC3DM
# if self.settings.gui_HSRAC and self.settings.gui_HSRACP == 1:
# self.firstalgo = self.HSRACM
# elif self.settings.gui_HSRAC and self.settings.gui_HSRACP == 2:
# self.secondalgo = self.HSRACM
# elif self.settings.gui_HSRAC and self.settings.gui_HSRACP == 3:
# self.thirdalgo = self.HSRACM
# elif self.settings.gui_HSRAC and self.settings.gui_HSRACP == 4:
# self.fourthalgo = self.HSRACM
if self.settings.gui_HSRAC and self.settings.gui_HSRACP == 1:
self.firstalgo = self.HSRACM
elif self.settings.gui_HSRAC and self.settings.gui_HSRACP == 2:
self.secondalgo = self.HSRACM
elif self.settings.gui_HSRAC and self.settings.gui_HSRACP == 3:
self.thirdalgo = self.HSRACM
elif self.settings.gui_HSRAC and self.settings.gui_HSRACP == 4:
self.fourthalgo = self.HSRACM
if self.settings.gui_BLOB and self.settings.gui_BLOBP == 1:
self.firstalgo = self.BLOBM

View File

@ -13,7 +13,7 @@ import urllib.request
import webbrowser
os.system('color') # init ANSI color
# Random environment variable to speed up webcam opening on the MSMF backend.
# https://github.com/opencv/opencv/issues/17687

View File

@ -19,7 +19,6 @@ from utils.misc_utils import clamp
thresh_add = 10
video_path = "ezgif.com-gif-maker.avi"
imshow_enable = True
calc_print_enable = True
save_video = False

View File

@ -161,18 +161,30 @@ class IntensityBasedOpeness:
# print(frame.shape[1], frame.shape[0], int_x, int_y, eye)
changed = False
newval_flg = False
if int_y >= frame.shape[0]:
# data_val = 1
int_y = frame.shape[0] - 1
print('CAUGHT Y OUT OF BOUNDS')
oob = False
if int_x >= frame.shape[1]:
# data_val = 1
int_x = frame.shape[0] - 1
obb = True
print('CAUGHT X OUT OF BOUNDS')
if int_x < 0:
int_x = True
print('CAUGHT X UNDER BOUNDS')
if int_x >= frame.shape[1]:
int_x = frame.shape[0] - 1
oob = True
print('CAUGHT X OUT OF BOUNDS')
data_val = self.data[int_y, int_x]
if int_x < 0:
int_x = 1
oob = True
print('CAUGHT X UNDER BOUNDS')
if oob != True:
data_val = self.data[int_y, int_x]
else:
data_val = 0
# max pupil per cord
if data_val == 0:
# The value of the specified coordinates has not yet been recorded.
@ -183,7 +195,7 @@ class IntensityBasedOpeness:
if intensity < data_val: # if current intensity value is less (more pupil), save that
self.data[int_y, int_x] = intensity # set value
changed = True
print("var adjusted")
# print("var adjusted")
else:
intensitya = max(data_val - 3, 1) # if current intensity value is less (more pupil), save that
self.data[int_y, int_x] = intensitya # set value
@ -192,11 +204,11 @@ class IntensityBasedOpeness:
# min pupil global
if self.maxval == 0: # that value is not yet saved
self.maxval = intensity # set value at 0 index
print("create max", intensity)
# print("create max", intensity)
else:
if intensity > self.maxval: # if current intensity value is more (less pupil), save that NOTE: we have the
self.maxval = intensity # set value at 0 index
print("new max", intensity)
# print("new max", intensity)
else:
intensityd = max(self.maxval - 10, 1) # continuously adjust closed intensity, will be set when user blink, used to allow eyes to close when lighting changes
self.maxval = intensityd # set value at 0 index
@ -213,7 +225,7 @@ class IntensityBasedOpeness:
eyeopen = 1 - eyeopen
# eyeopen = eyeopen - 0.2
# print(intensity, maxp, minp, x, y)
# print(f"EYEOPEN: {eyeopen}")
print(f"EYEOPEN: {eyeopen}")
# print(int(x), int(y), eyeopen, maxp, minp)
# print(self.data[0, -1])
# print(self.maxval)