stability update

This commit is contained in:
Prohurtz 2022-01-14 14:48:20 -08:00 committed by GitHub
parent 8710f14c4a
commit 4f41bd9514
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,10 +4,13 @@ import threading
import time
import os
try:
fy= open("camport.txt","r+")
camport = fy.read().strip()
fy.close
except:
print('Error: Run Gui first and adjust camera port')
time.sleep(5)
bl = False
cap = cv2.VideoCapture(int(camport))
@ -21,25 +24,45 @@ def lefteye():
break
################################################ Reads values set in gui, needs rework to single config file
try:
fy= open("valueY.txt","r+")
vy = fy.read().strip()
fy.close
except:
print('Error: Run Gui first and adjust Value Y')
time.sleep(5)
################################################
try:
fx= open("valueX.txt","r+")
vx = fx.read().strip()
fx.close
except:
print('Error: Run Gui first and adjust Value X')
time.sleep(5)
################################################
try:
vyll= open("valueYl.txt","r+")
vyl = vyll.read().strip()
vyll.close
except:
print('Error: Run Gui first and adjust Value Y L')
time.sleep(5)
################################################
try:
vxll= open("valueXl.txt","r+")
vxl = vxll.read().strip()
vxll.close
except:
print('Error: Run Gui first and adjust Value X L')
time.sleep(5)
################################################
try:
thresh= open("thresh.txt","r+")
threshr = thresh.read().strip()
thresh.close
except:
print('Error: Run Gui first and adjust threshold value')
time.sleep(5)
################################################
try: # trys at set size if it errors it will revert to working size/ doesnt do what was orrigionally planed, it kinda helps, entire thing will eventually go into try and except later
@ -47,7 +70,7 @@ def lefteye():
except:
roi = frame[100: 300, 200: 316]
try:
rows, cols, _ = roi.shape
gray_roi = cv2.cvtColor(roi, cv2.COLOR_BGR2GRAY)
gray_roi = cv2.GaussianBlur(gray_roi, (7, 7), 0)
@ -88,11 +111,12 @@ def lefteye():
cv2.imshow("GreyScale", gray_roi)
#cv2.imshow("Roi", roi)
key = cv2.waitKey(30)
except:
print('ERROR 1: Something went wrong trying to track your eye. Contact the ')
print('###############> initailizing <###############')
cv2.destroyAllWindows()
if __name__ == '__main__':
lefteye()
print('Running:')