mirror of
https://github.com/EyeTrackVR/EyeTrackVR.git
synced 2025-11-04 14:39:42 +08:00
small eyeopen cleanup
This commit is contained in:
parent
56392bd65b
commit
9abb30d000
@ -268,12 +268,12 @@ class EyeProcessor:
|
|||||||
# self.output_images_and_update(thresh, EyeInformation(InformationOrigin.HSRAC, 0, 0, 0, False))
|
# self.output_images_and_update(thresh, EyeInformation(InformationOrigin.HSRAC, 0, 0, 0, False))
|
||||||
def HSFM(self):
|
def HSFM(self):
|
||||||
cx, cy, frame = External_Run_HSF.HSFS(self)
|
cx, cy, frame = External_Run_HSF.HSFS(self)
|
||||||
intense(cx, cy, frame)
|
eyeopen = intense(cx, cy, frame) #not sure if i want this run on every algo or on the system..
|
||||||
out_x, out_y = cal_osc(self, cx, cy)
|
out_x, out_y = cal_osc(self, cx, cy)
|
||||||
if cx == 0:
|
if cx == 0:
|
||||||
self.output_images_and_update(frame, EyeInformation(InformationOrigin.HSF, out_x, out_y, 0, True)) #update app
|
self.output_images_and_update(frame, EyeInformation(InformationOrigin.HSF, out_x, out_y, 0, True)) #update app
|
||||||
else:
|
else:
|
||||||
self.output_images_and_update(frame, EyeInformation(InformationOrigin.HSF, out_x, out_y, 0, self.blinkvalue))
|
self.output_images_and_update(frame, EyeInformation(InformationOrigin.HSF, out_x, out_y, 0, eyeopen))
|
||||||
|
|
||||||
|
|
||||||
def RANSAC3DM(self):
|
def RANSAC3DM(self):
|
||||||
|
|||||||
@ -5,10 +5,6 @@ from pythonosc import udp_client
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
OSCip="127.0.0.1"
|
OSCip="127.0.0.1"
|
||||||
OSCport=9000 #VR Chat OSC port
|
OSCport=9000 #VR Chat OSC port
|
||||||
client = udp_client.SimpleUDPClient(OSCip, OSCport)
|
client = udp_client.SimpleUDPClient(OSCip, OSCport)
|
||||||
@ -23,35 +19,35 @@ client = udp_client.SimpleUDPClient(OSCip, OSCport)
|
|||||||
fname = "test_list.txt"
|
fname = "test_list.txt"
|
||||||
data = pd.read_csv(fname, sep=",")
|
data = pd.read_csv(fname, sep=",")
|
||||||
|
|
||||||
print (data)
|
|
||||||
xy = 69
|
|
||||||
|
|
||||||
def intense(x, y, frame):
|
def intense(x, y, frame):
|
||||||
xy = int(str(x) + str(y))
|
xy = int(str(x) + str(y) + str(x+y))
|
||||||
intensity = np.sum(frame)
|
intensity = np.sum(frame)
|
||||||
#print(intensity)
|
#print(intensity)
|
||||||
|
changed = False
|
||||||
try: #max pupil per cord
|
try: #max pupil per cord
|
||||||
dfb = data[data['xy']==xy].index.values.astype(int)[0] # find pandas index of line with matching xy value
|
dfb = data[data['xy']==xy].index.values.astype(int)[0] # find pandas index of line with matching xy value
|
||||||
|
|
||||||
if intensity < data.at[dfb, 'intensity']: #if current intensity value is less (more pupil), save that
|
if intensity < data.at[dfb, 'intensity']: #if current intensity value is less (more pupil), save that
|
||||||
data.at[dfb, 'intensity'] = intensity # set value
|
data.at[dfb, 'intensity'] = intensity # set value
|
||||||
data.to_csv(fname, encoding='utf-8', index=False) #save file since we made a change
|
changed = True
|
||||||
|
|
||||||
|
|
||||||
except: # that value is not yet saved
|
except: # that value is not yet saved
|
||||||
data.loc[len(data.index)] = [xy, intensity] #create new data on last line of csv with current intesity
|
data.loc[len(data.index)] = [xy, intensity] #create new data on last line of csv with current intesity
|
||||||
data.to_csv(fname, encoding='utf-8', index=False) #save file since we made a change
|
changed = True
|
||||||
|
|
||||||
|
|
||||||
try: # min pupil global
|
try: # min pupil global
|
||||||
if intensity > data.at[0, 'intensity']: #if current intensity value is more (less pupil), save that NOTE: we have the
|
if intensity > data.at[0, 'intensity']: #if current intensity value is more (less pupil), save that NOTE: we have the
|
||||||
data.at[0, 'intensity'] = intensity # set value at 0 index
|
data.at[0, 'intensity'] = intensity # set value at 0 index
|
||||||
data.to_csv(fname, encoding='utf-8', index=False) #save file since we made a change
|
changed = True
|
||||||
|
|
||||||
print("new max", intensity)
|
print("new max", intensity)
|
||||||
|
|
||||||
except: # there is no max intensity yet, create
|
except: # there is no max intensity yet, create
|
||||||
data.at[0, 'intensity'] = intensity # set value at 0 index
|
data.at[0, 'intensity'] = intensity # set value at 0 index
|
||||||
data.to_csv(fname, encoding='utf-8', index=False) #save file since we made a change
|
changed = True
|
||||||
print("create max", intensity)
|
print("create max", intensity)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -65,7 +61,12 @@ def intense(x, y, frame):
|
|||||||
client.send_message("/avatar/parameters/RightEyeLidExpandedSqueeze", float(eyeopen)) # open r
|
client.send_message("/avatar/parameters/RightEyeLidExpandedSqueeze", float(eyeopen)) # open r
|
||||||
client.send_message("/avatar/parameters/LeftEyeLidExpandedSqueeze", float(eyeopen))
|
client.send_message("/avatar/parameters/LeftEyeLidExpandedSqueeze", float(eyeopen))
|
||||||
except:
|
except:
|
||||||
print('e')
|
print('[INFO] Something went wrong, assuming blink.')
|
||||||
|
eyeopen = 0.0
|
||||||
|
|
||||||
|
if changed == True:
|
||||||
|
data.to_csv(fname, encoding='utf-8', index=False) #save file since we made a change
|
||||||
|
|
||||||
#e = data.at[dfb,'intensity'] #find intensity with value
|
#e = data.at[dfb,'intensity'] #find intensity with value
|
||||||
|
|
||||||
|
|
||||||
@ -77,7 +78,7 @@ def intense(x, y, frame):
|
|||||||
|
|
||||||
#data.loc[len(data.index)] = [xy, intensity]
|
#data.loc[len(data.index)] = [xy, intensity]
|
||||||
|
|
||||||
return
|
return eyeopen
|
||||||
|
|
||||||
#vid = cv2.VideoCapture("http://192.168.1.43:4747/video")
|
#vid = cv2.VideoCapture("http://192.168.1.43:4747/video")
|
||||||
#x = int(input("x"))
|
#x = int(input("x"))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user