-
Notifications
You must be signed in to change notification settings - Fork 0
/
nn.py
37 lines (29 loc) · 842 Bytes
/
nn.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import socket
import time
# import tflearn
import cv2
import numpy as np
import config
from screen import grab_screen, place_emulator
from util import process_img
HOST = config.HOST
PORT = config.PORT
IMG_WIDTH = config.IMG_WIDTH
IMG_HEIGHT = config.IMG_HEIGHT
SCREEN_POS_X = config.SCREEN_POS_X
SCREEN_POS_Y = config.SCREEN_POS_Y
SCREEN_REGION = (SCREEN_POS_X, SCREEN_POS_Y, IMG_WIDTH + SCREEN_POS_X, IMG_HEIGHT + SCREEN_POS_Y)
file_name = config.training_file_name
def test():
screen = grab_screen(SCREEN_REGION)
screen = np.array(screen, np.uint8)
# screen = process_img(screen)
cv2.imshow("test", screen)
if cv2.waitKey(25) & 0xFF == ord("q"):
cv2.destroyAllWindows()
# cv2.namedWindow("test", cv2.WINDOW_AUTOSIZE)
place_emulator()
while True:
last_time = time.time()
test()
print("frametiem:", time.time() - last_time)