diff --git a/configs/config_phone_turnback.json b/configs/config_phone_turnback.json new file mode 100644 index 0000000..7e46ae8 --- /dev/null +++ b/configs/config_phone_turnback.json @@ -0,0 +1,21 @@ +{ + "MonitorWindow": false, + "WindowPrefix": "", + "image": "./images/phone_turnback/eye.png", + "view": [ + 286, + 231, + 37, + 36 + ], + "thresh": 0.9, + "white_delay": 0.0, + "advance_delay": 0, + "crop": [ + 0, + 0, + 0, + 0 + ], + "camera": 3 +} \ No newline at end of file diff --git a/images/phone_turnback/eye.png b/images/phone_turnback/eye.png new file mode 100644 index 0000000..c88172d Binary files /dev/null and b/images/phone_turnback/eye.png differ diff --git a/src/rngtool.py b/src/rngtool.py index 9e37954..7ccca4a 100644 --- a/src/rngtool.py +++ b/src/rngtool.py @@ -65,7 +65,10 @@ def tracking_blink(img, roi_x, roi_y, roi_w, roi_h, th = 0.9, size = 40, Monitor exit() _, frame = video.read() if not MonitorWindow: - frame = cv2.resize(frame,(960,540)) + size = frame.shape[::-1] + _, fw, fh = size + if fw >= 1920: + frame = cv2.resize(frame,(960,round(fh/fw*960))) 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(): @@ -214,7 +217,10 @@ def tracking_poke_blink(img, roi_x, roi_y, roi_w, roi_h, size = 60, MonitorWindo while len(intervals)= 1920: + frame = cv2.resize(frame,(960,round(fh/fw*960))) time_counter = time.perf_counter() roi = cv2.cvtColor(frame[roi_y:roi_y+roi_h,roi_x:roi_x+roi_w],cv2.COLOR_RGB2GRAY)