-
Notifications
You must be signed in to change notification settings - Fork 2
/
test_1.py
36 lines (26 loc) · 1.04 KB
/
test_1.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
import cv2
from viewer import AndroidViewer
# This will deploy and run server on android device connected to USB
android = AndroidViewer()
while True:
frames = android.get_next_frames()
# if frames != None:
# print(frames)
if frames is None:
continue
for frame in frames:
# cv2.imshow('game', frame)
# cv2.waitKey(1)
#percent by which the image is resized
scale_percent = 45
#calculate the 50 percent of original dimensions
width = int(frame.shape[1] * scale_percent / 100)
height = int(frame.shape[0] * scale_percent / 100)
# dsize
dsize = (width, height)
# cv2.namedWindow("output", cv2.WINDOW_NORMAL) # Create window with freedom of dimensions
# im = cv2.imread("earth.jpg") # Read image
imS = cv2.resize(frame, dsize) # Resize image
cv2.imshow("Phone Viewer", imS) # Show image
cv2.waitKey(1)
android.swipe(660, 739, 660, 739)