mirror of
https://github.com/jjaldridge2009/Project_Xs.git
synced 2024-11-19 17:02:33 +01:00
window monitor
This commit is contained in:
parent
48c59498bb
commit
5e42f324b8
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"SysDVR": true,
|
"MonitorWindow": true,
|
||||||
|
"WindowPrefix": "SysDVR-Client [PID ",
|
||||||
"image": "./munchlax/eye.png",
|
"image": "./munchlax/eye.png",
|
||||||
"view": [470, 430, 50, 60],
|
"view": [470, 430, 50, 60],
|
||||||
"reidentify": ""
|
"reidentify": ""
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"SysDVR": true,
|
"MonitorWindow": true,
|
||||||
|
"WindowPrefix": "SysDVR-Client [PID ",
|
||||||
"image": "./trainer/cave/eye.png",
|
"image": "./trainer/cave/eye.png",
|
||||||
"view": [610, 330, 30, 30],
|
"view": [610, 330, 30, 30],
|
||||||
"reidentify": "0x37a35d28 0x488e6831 0xb7f56519 0x79a3b387"
|
"reidentify": "0x37a35d28 0x488e6831 0xb7f56519 0x79a3b387"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"SysDVR": true,
|
"MonitorWindow": true,
|
||||||
|
"WindowPrefix": "SysDVR-Client [PID ",
|
||||||
"image": "./munchlax/eye.png",
|
"image": "./munchlax/eye.png",
|
||||||
"view": [470, 430, 50, 60],
|
"view": [470, 430, 50, 60],
|
||||||
"reidentify": ""
|
"reidentify": ""
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"SysDVR": true,
|
"MonitorWindow": true,
|
||||||
|
"WindowPrefix": "SysDVR-Client [PID ",
|
||||||
"image": "./trainer/ruins/eye.png",
|
"image": "./trainer/ruins/eye.png",
|
||||||
"view": [610, 330, 30, 30],
|
"view": [610, 330, 30, 30],
|
||||||
"reidentify": ""
|
"reidentify": ""
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"SysDVR": true,
|
"MonitorWindow": true,
|
||||||
|
"WindowPrefix": "SysDVR-Client [PID ",
|
||||||
"image": "./trainer/ruins/eye.png",
|
"image": "./trainer/ruins/eye.png",
|
||||||
"view": [610, 330, 30, 30],
|
"view": [610, 330, 30, 30],
|
||||||
"reidentify": ""
|
"reidentify": ""
|
||||||
|
@ -4,9 +4,9 @@ import json
|
|||||||
|
|
||||||
config = json.load(open("config.json"))
|
config = json.load(open("config.json"))
|
||||||
|
|
||||||
if config["SysDVR"]:
|
if config["MonitorWindow"]:
|
||||||
from windowcapture import WindowCapture
|
from windowcapture import WindowCapture
|
||||||
video = WindowCapture("SysDVR-Client [PID ")
|
video = WindowCapture(config["WindowPrefix"])
|
||||||
else:
|
else:
|
||||||
video = cv2.VideoCapture(0,cv2.CAP_DSHOW)
|
video = cv2.VideoCapture(0,cv2.CAP_DSHOW)
|
||||||
video.set(cv2.CAP_PROP_FRAME_WIDTH,1920)
|
video.set(cv2.CAP_PROP_FRAME_WIDTH,1920)
|
||||||
|
@ -16,7 +16,7 @@ def randrange(r,mi,ma):
|
|||||||
t = (r & 0x7fffff) / 8388607.0
|
t = (r & 0x7fffff) / 8388607.0
|
||||||
return t * mi + (1.0 - t) * ma
|
return t * mi + (1.0 - t) * ma
|
||||||
|
|
||||||
def tracking_blink(img, roi_x, roi_y, roi_w, roi_h, th = 0.9, size = 40, sysdvr = False)->Tuple[List[int],List[int],float]:
|
def tracking_blink(img, roi_x, roi_y, roi_w, roi_h, th = 0.9, size = 40, MonitorWindow = False, WindowPrefix = "SysDVR-Client [PID ")->Tuple[List[int],List[int],float]:
|
||||||
"""measuring the type and interval of player's blinks
|
"""measuring the type and interval of player's blinks
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@ -25,9 +25,9 @@ def tracking_blink(img, roi_x, roi_y, roi_w, roi_h, th = 0.9, size = 40, sysdvr
|
|||||||
|
|
||||||
eye = img
|
eye = img
|
||||||
|
|
||||||
if sysdvr:
|
if MonitorWindow:
|
||||||
from windowcapture import WindowCapture
|
from windowcapture import WindowCapture
|
||||||
video = WindowCapture("SysDVR-Client [PID ")
|
video = WindowCapture(WindowPrefix)
|
||||||
else:
|
else:
|
||||||
video = cv2.VideoCapture(0,cv2.CAP_DSHOW)
|
video = cv2.VideoCapture(0,cv2.CAP_DSHOW)
|
||||||
video.set(cv2.CAP_PROP_FRAME_WIDTH,1920)
|
video.set(cv2.CAP_PROP_FRAME_WIDTH,1920)
|
||||||
@ -143,7 +143,7 @@ def tracking_blink_manual(size = 40, reidentify = False)->Tuple[List[int],List[i
|
|||||||
|
|
||||||
return (blinks, intervals, offset_time)
|
return (blinks, intervals, offset_time)
|
||||||
|
|
||||||
def tracking_poke_blink(img, roi_x, roi_y, roi_w, roi_h, size = 60, sysdvr = False)->Tuple[List[int],List[int],float]:
|
def tracking_poke_blink(img, roi_x, roi_y, roi_w, roi_h, size = 60, MonitorWindow = False, WindowPrefix = "SysDVR-Client [PID ")->Tuple[List[int],List[int],float]:
|
||||||
"""measuring the type and interval of pokemon's blinks
|
"""measuring the type and interval of pokemon's blinks
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@ -152,9 +152,9 @@ def tracking_poke_blink(img, roi_x, roi_y, roi_w, roi_h, size = 60, sysdvr = Fal
|
|||||||
|
|
||||||
eye = img
|
eye = img
|
||||||
|
|
||||||
if sysdvr:
|
if MonitorWindow:
|
||||||
from windowcapture import WindowCapture
|
from windowcapture import WindowCapture
|
||||||
video = WindowCapture("SysDVR-Client [PID ")
|
video = WindowCapture(WindowPrefix)
|
||||||
else:
|
else:
|
||||||
video = cv2.VideoCapture(0,cv2.CAP_DSHOW)
|
video = cv2.VideoCapture(0,cv2.CAP_DSHOW)
|
||||||
video.set(cv2.CAP_PROP_FRAME_WIDTH,1920)
|
video.set(cv2.CAP_PROP_FRAME_WIDTH,1920)
|
||||||
|
@ -32,7 +32,7 @@ def expr():
|
|||||||
if munch_eye is None:
|
if munch_eye is None:
|
||||||
print("path is wrong")
|
print("path is wrong")
|
||||||
return
|
return
|
||||||
gombe_intervals = rngtool.tracking_poke_blink(munch_eye, *config["view"], size=60, sysdvr=config["SysDVR"])
|
gombe_intervals = rngtool.tracking_poke_blink(munch_eye, *config["view"], size=60, MonitorWindow=config["MonitorWindow"], WindowPrefix=config["WindowPrefix"])
|
||||||
|
|
||||||
interval_prng = rngtool.recovByMunchlax(gombe_intervals)
|
interval_prng = rngtool.recovByMunchlax(gombe_intervals)
|
||||||
state = interval_prng.getState()
|
state = interval_prng.getState()
|
||||||
|
@ -11,7 +11,7 @@ def expr():
|
|||||||
if player_eye is None:
|
if player_eye is None:
|
||||||
print("path is wrong")
|
print("path is wrong")
|
||||||
return
|
return
|
||||||
blinks, intervals, offset_time = rngtool.tracking_blink(player_eye, *config["view"], sysdvr=config["SysDVR"])
|
blinks, intervals, offset_time = rngtool.tracking_blink(player_eye, *config["view"], MonitorWindow=config["MonitorWindow"], WindowPrefix=config["WindowPrefix"])
|
||||||
prng = rngtool.recov(blinks, intervals)
|
prng = rngtool.recov(blinks, intervals)
|
||||||
|
|
||||||
waituntil = time.perf_counter()
|
waituntil = time.perf_counter()
|
||||||
@ -43,7 +43,7 @@ def reidentify():
|
|||||||
print("path is wrong")
|
print("path is wrong")
|
||||||
return
|
return
|
||||||
|
|
||||||
observed_blinks, _, offset_time = rngtool.tracking_blink(player_eye, *config["view"], sysdvr=config["SysDVR"], size=20)
|
observed_blinks, _, offset_time = rngtool.tracking_blink(player_eye, *config["view"], MonitorWindow=config["MonitorWindow"], WindowPrefix=config["WindowPrefix"], size=20)
|
||||||
reidentified_rng = rngtool.reidentifyByBlinks(Xorshift(*state), observed_blinks)
|
reidentified_rng = rngtool.reidentifyByBlinks(Xorshift(*state), observed_blinks)
|
||||||
|
|
||||||
waituntil = time.perf_counter()
|
waituntil = time.perf_counter()
|
||||||
|
@ -13,7 +13,7 @@ class WindowCapture:
|
|||||||
self.offset_x = 0
|
self.offset_x = 0
|
||||||
self.offset_y = 0
|
self.offset_y = 0
|
||||||
|
|
||||||
# a string contained in the window title, used to find windows who's name is not constant (pid of sysdvr changes)
|
# a string contained in the window title, used to find windows who's name is not constant (pid of MonitorWindow changes)
|
||||||
self.partial_window_title = partial_window_title
|
self.partial_window_title = partial_window_title
|
||||||
# find the handle for the window we want to capture
|
# find the handle for the window we want to capture
|
||||||
hwnds = []
|
hwnds = []
|
||||||
|
Loading…
Reference in New Issue
Block a user