adjust thresh, IBO

This commit is contained in:
Prohurtz 2023-03-17 11:14:13 -05:00
parent ae4c49d49c
commit 4b361a74db
5 changed files with 9 additions and 8 deletions

View File

@ -7,7 +7,7 @@ def BLINK(self):
if intensity > self.max_int:
self.max_int = intensity
if self.frames > 200:
if self.frames > 400: #TODO: test this number more (make it a setting??)
self.max_ints.append(self.max_int)
if intensity < self.min_int:
self.min_int = intensity

View File

@ -248,12 +248,11 @@ class EyeProcessor:
pass
def BLINKM(self):
self.eyeoffx = BLINK(self)
x = BLINK(self)
def DADDYM(self):
landmark = self.daddy.run(self.current_image_gray)
def HSRACM(self):
# todo: added process to initialise er_hsrac when resolution changes
cx, cy, thresh, gray_frame, uncropframe = self.er_hsrac.run(self.current_image_gray)
@ -272,7 +271,7 @@ class EyeProcessor:
#print(self.eyeoffx, self.eyeopen)
if self.eyeoffx:
self.output_images_and_update(thresh, EyeInformation(InformationOrigin.HSRAC, out_x, out_y, 0, 0.0)) #update app
self.output_images_and_update(thresh, EyeInformation(InformationOrigin.HSRAC, out_x, out_y, 0, self.eyeopen)) #update app
else:
self.output_images_and_update(thresh, EyeInformation(InformationOrigin.HSRAC, out_x, out_y, 0, self.eyeopen))
# else:

View File

@ -386,7 +386,8 @@ class HSRAC_cls(object):
# threshold_value = min_val + thresh_add
if not blink_bd and self.blink_detector.enable_detect_flg:
cv2.threshold(frame_gray_crop, (min_val + thresh_add + self.center_q1.quartile_1) / 2, 255, cv2.THRESH_BINARY_INV, dst=th_frame)
print(min_val, thresh_add, self.center_q1.quartile_1)
cv2.threshold(frame_gray_crop, ((min_val + self.center_q1.quartile_1) - 10) / 2, 255, cv2.THRESH_BINARY_INV, dst=th_frame)
cv2.morphologyEx(th_frame, cv2.MORPH_OPEN, self.kernel, dst=fic_frame)
# cv2.morphologyEx(fic_frame, cv2.MORPH_CLOSE, self.kernel, dst=fic_frame)
# cv2.erode(fic_frame,self.kernel,dst=fic_frame)

View File

@ -150,8 +150,8 @@ class IntensityBasedOpeness:
upper_y = min(int_y + 25, frame.shape[0])
lower_y = max(int_y - 25, 0)
# frame_crop = frame[lower_y:upper_y, lower_x:upper_x]
frame_crop = frame
frame_crop = frame[lower_y:upper_y, lower_x:upper_x]
# frame_crop = frame
# 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

View File

@ -46,7 +46,8 @@ class VRChatOSC:
except:
continue
#eye_info.blink
#print(eye_info.blink)
#TODO: Re write this mess
if eye_info.blink > 0.1: #if eye is not "closed" this will need tuning
if self.config.tracker_single_eye == 1 or self.config.tracker_single_eye == 2:
self.client.send_message("/avatar/parameters/LeftEyeX", eye_info.x) # only one eye is detected or there is an error. Send mirrored data to both eyes.