small update

This commit is contained in:
Prohurtz 2022-12-23 09:52:39 -08:00
parent 631410ac4d
commit c0004eec3f

View File

@ -130,6 +130,7 @@ def cal_osc(self, cx, cy):
else: else:
self.ts = 10 self.ts = 10
try:
xl = float( xl = float(
(cx - self.xoff) / (self.xmax - self.xoff) (cx - self.xoff) / (self.xmax - self.xoff)
) )
@ -166,7 +167,8 @@ def cal_osc(self, cx, cy):
out_x = max(0.0, min(1.0, xr)) out_x = max(0.0, min(1.0, xr))
if xl > 0: if xl > 0:
out_x = -abs(max(0.0, min(1.0, xl))) out_x = -abs(max(0.0, min(1.0, xl)))
except:
print("[ERROR] Eye Calibration Invalid!")
try: try:
noisy_point = np.array([float(out_x), float(out_y)]) # fliter our values with a One Euro Filter noisy_point = np.array([float(out_x), float(out_y)]) # fliter our values with a One Euro Filter
point_hat = self.one_euro_filter(noisy_point) point_hat = self.one_euro_filter(noisy_point)
@ -888,8 +890,8 @@ class EyeProcessor:
if len(contours) == 0: if len(contours) == 0:
raise RuntimeError("No contours found for image") raise RuntimeError("No contours found for image")
except: except:
self.output_images_and_update(larger_threshold, EyeInformation(InformationOrigin.FAILURE, 0, 0, 0, False))
self.failed = self.failed + 1 self.failed = self.failed + 1
self.output_images_and_update(larger_threshold, EyeInformation(InformationOrigin.FAILURE, 0, 0, 0, False))
return return
rows, cols = larger_threshold.shape rows, cols = larger_threshold.shape
@ -937,8 +939,9 @@ class EyeProcessor:
self.failed = 0 self.failed = 0
return return
self.output_images_and_update(larger_threshold, EyeInformation(InformationOrigin.BLOB, 0, 0, 0, self.blinkvalue))
self.failed = self.failed + 1 self.failed = self.failed + 1
self.output_images_and_update(larger_threshold, EyeInformation(InformationOrigin.BLOB, 0, 0, 0, self.blinkvalue))
def HSF(self): def HSF(self):
@ -1573,31 +1576,39 @@ class EyeProcessor:
def ALGOSELECT(self): def ALGOSELECT(self):
if self.failed == 0 and self.firstalgo != None: if self.failed == 0 and self.firstalgo != None:
print('first')
self.firstalgo() self.firstalgo()
else: else:
self.failed = self.failed + 1 self.failed = self.failed + 1
if self.failed == 1 and self.secondalgo != None: if self.failed == 1 and self.secondalgo != None:
print('2nd')
self.secondalgo() #send the tracking algos previous fail number, in algo if we pass set to 0, if fail, + 1 self.secondalgo() #send the tracking algos previous fail number, in algo if we pass set to 0, if fail, + 1
else: else:
self.failed = self.failed + 1 self.failed = self.failed + 1
if self.failed == 2 and self.thirdalgo != None: if self.failed == 2 and self.thirdalgo != None:
print('3rd')
self.thirdalgo() self.thirdalgo()
else: else:
self.failed = self.failed + 1 self.failed = self.failed + 1
if self.failed == 3 and self.fourthalgo != None: if self.failed == 3 and self.fourthalgo != None:
print('4th')
self.fourthalgo() self.fourthalgo()
else: else:
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
print(self.failed)
def run(self): def run(self):
print("running")
self.firstalgo = None self.firstalgo = None
self.secondalgo = None self.secondalgo = None
self.thirdalgo = None self.thirdalgo = None
@ -1630,13 +1641,13 @@ class EyeProcessor:
elif self.settings.gui_HSRAC and self.settings.gui_HSRACP == 4: elif self.settings.gui_HSRAC and self.settings.gui_HSRACP == 4:
self.fourthalgo = self.HSRAC self.fourthalgo = self.HSRAC
if self.settings.gui_HSRAC and self.settings.gui_BLOBP == 1: if self.settings.gui_BLOB and self.settings.gui_BLOBP == 1:
self.firstalgo = self.BLOB self.firstalgo = self.BLOB
elif self.settings.gui_HSRAC and self.settings.gui_BLOBP == 2: elif self.settings.gui_BLOB and self.settings.gui_BLOBP == 2:
self.secondalgo = self.BLOB self.secondalgo = self.BLOB
elif self.settings.gui_HSRAC and self.settings.gui_BLOBP == 3: elif self.settings.gui_BLOB and self.settings.gui_BLOBP == 3:
self.thirdalgo = self.BLOB self.thirdalgo = self.BLOB
elif self.settings.gui_HSRAC and self.settings.gui_BLOBP == 4: elif self.settings.gui_BLOB and self.settings.gui_BLOBP == 4:
self.fourthalgo = self.BLOB self.fourthalgo = self.BLOB