resize properly

This commit is contained in:
Lincoln-LM 2022-01-05 05:57:05 -07:00
parent f046e3bb9e
commit a7a37eca31
2 changed files with 6 additions and 1 deletions

View File

@ -426,7 +426,8 @@ class Application(tk.Frame):
w, h = eye.shape[::-1]
roi_x, roi_y, roi_w, roi_h = self.config_json["view"]
_, frame = video.read()
frame = cv2.resize(frame,(960,540))
if not self.config_json["MonitorWindow"]:
frame = cv2.resize(frame,(960,540))
roi = cv2.cvtColor(frame[roi_y:roi_y+roi_h,roi_x:roi_x+roi_w],cv2.COLOR_RGB2GRAY)
res = cv2.matchTemplate(roi,eye,cv2.TM_CCOEFF_NORMED)
_, match, _, max_loc = cv2.minMaxLoc(res)

View File

@ -55,6 +55,8 @@ def tracking_blink(img, roi_x, roi_y, roi_w, roi_h, th = 0.9, size = 40, Monitor
tk_window.monitor_tk = None
exit()
_, frame = video.read()
if not MonitorWindow:
frame = cv2.resize(frame,(960,540))
time_counter = time.perf_counter()
roi = cv2.cvtColor(frame[roi_y:roi_y+roi_h,roi_x:roi_x+roi_w],cv2.COLOR_RGB2GRAY)
if (roi==prev_roi).all():
@ -194,6 +196,8 @@ def tracking_poke_blink(img, roi_x, roi_y, roi_w, roi_h, size = 60, MonitorWindo
# 瞬きの観測
while len(intervals)<size:
_, frame = video.read()
if not MonitorWindow:
frame = cv2.resize(frame,(960,540))
time_counter = time.perf_counter()
roi = cv2.cvtColor(frame[roi_y:roi_y+roi_h,roi_x:roi_x+roi_w],cv2.COLOR_RGB2GRAY)