remove debug prints in IBO

This commit is contained in:
Prohurtz 2023-03-17 14:29:05 -05:00
parent bfb588ef6f
commit e149db16e0

View File

@ -144,27 +144,22 @@ class IntensityBasedOpeness:
def intense(self, x, y, frame): def intense(self, x, y, frame):
self.check(frame.shape) self.check(frame.shape)
int_x, int_y = int(x), int(y) int_x, int_y = int(x), int(y)
print(int_x, int_y, frame.shape[1], frame.shape[0] )
upper_x = min(int_x + 25, frame.shape[1]) #TODO make this a setting upper_x = min(int_x + 25, frame.shape[1]) #TODO make this a setting
lower_x = max(int_x - 25, 0) lower_x = max(int_x - 25, 0)
upper_y = min(int_y + 25, frame.shape[0]) upper_y = min(int_y + 25, frame.shape[0])
lower_y = max(int_y - 25, 0) lower_y = max(int_y - 25, 0)
frame_crop = frame[lower_y:upper_y, lower_x:upper_x] frame_crop = frame[lower_y:upper_y, lower_x:upper_x]
# frame_crop = frame
# cv2.imwrite("frame.jpg", frame_crop)
# The same can be done with cv2.integral, but since there is only one area of the rectangle for which we want to know the total value, there is no advantage in terms of computational complexity. # The same can be done with cv2.integral, but since there is only one area of the rectangle for which we want to know the total value, there is no advantage in terms of computational complexity.
intensity = frame_crop.sum() + 1 intensity = frame_crop.sum() + 1
# numpy:np.sum(),ndarray.sum() # numpy:np.sum(),ndarray.sum()
# opencv:cv2.sumElems() # opencv:cv2.sumElems()
# I don't know which is faster. # I don't know which is faster.
# print(frame.shape[1], frame.shape[0], int_x, int_y, eye)
changed = False changed = False
newval_flg = False newval_flg = False
oob = False oob = False
# if int_x >= frame.shape[1]: #TODO: deprecate once wider testing is done
# if int_x >= frame.shape[1]:
# int_x = frame.shape[1] - 1 # int_x = frame.shape[1] - 1
# obb = True # obb = True
# print('CAUGHT X OUT OF BOUNDS') # print('CAUGHT X OUT OF BOUNDS')
@ -197,20 +192,17 @@ class IntensityBasedOpeness:
if intensity < data_val: # if current intensity value is less (more pupil), save that if intensity < data_val: # if current intensity value is less (more pupil), save that
self.data[int_y, int_x] = intensity # set value self.data[int_y, int_x] = intensity # set value
changed = True changed = True
# print("var adjusted")
else: else:
intensitya = max(data_val - 5, 1) # if current intensity value is less (more pupil), save that intensitya = max(data_val - 5, 1) # if current intensity value is less (more pupil), save that
self.data[int_y, int_x] = intensitya # set value self.data[int_y, int_x] = intensitya # set value
changed = True changed = True
# min pupil global # min pupil global
if self.maxval == 0: # that value is not yet saved if self.maxval == 0: # that value is not yet saved
self.maxval = intensity # set value at 0 index self.maxval = intensity # set value at 0 index
# print("create max", intensity)
else: else:
if intensity > self.maxval: # if current intensity value is more (less pupil), save that NOTE: we have the 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 self.maxval = intensity # set value at 0 index
# print("new max", intensity)
else: 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 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 self.maxval = intensityd # set value at 0 index