-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuffer.py
More file actions
34 lines (26 loc) · 1.01 KB
/
Copy pathbuffer.py
File metadata and controls
34 lines (26 loc) · 1.01 KB
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
import time, cv2
from MyVideoCapture import MyVideoCapture
def CloseConn(cam:MyVideoCapture):
print("Отключение камеры")
cam.Release()
cv2.destroyAllWindows()
print("End of CloseConn")
# connStr = "rtsp://admin:6m8vw@192.168.37.3:554/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif"
connStr = 0
camera = MyVideoCapture(connStr, 2000)
camera.Open()
while True:
time.sleep(0.05) # simulate time between events
if(camera.isReady == False):
break
frame = camera.read()
# Определение нового размера
new_width = int(frame.shape[1] * 0.2) # Уменьшение ширины дой50%
new_height = int(frame.shape[0] * 0.2) # Уменьшение высоты до 50%
# Изменение размера кадра
resized_frame = cv2.resize(frame, (new_width, new_height), interpolation=cv2.INTER_AREA)
cv2.imshow("frame", resized_frame)
ch = chr(cv2.waitKey(1)&255)
if ((ch == 'q') or (ch == 'é')):
break
CloseConn(camera)