-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain5.py
More file actions
57 lines (46 loc) · 1.36 KB
/
main5.py
File metadata and controls
57 lines (46 loc) · 1.36 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import pyrealsense2 as rs
import os
import cv2
import time
import numpy as np
import mediapipe as mp
from cameras import Cameras,CameraIntrinsics
from graphs.pipeline5 import Pipeline2
#test git up
if __name__=='__main__':
mp_drawing = mp.solutions.drawing_utils
pipe = Pipeline2()
cams = Cameras()
cams.captureRGBandDepth(0)
cams.captureRGBandDepth(1)
f_count=0
t1=time.time()
while (True):
if f_count>30:
t1=time.time()
f_count=0
f_count+=1
img0,depth0=cams.getRGBandDepthFrame(0)
img1,depth1=cams.getRGBandDepthFrame(1)
# img1=img0
# depth1=depth0
img,screen = pipe.forward(
img0.colorframe,
img1.colorframe,
depthframe0=depth0,
depthframe1=depth1,
intrinsics0=img0.intrinsics,
intrinsics1=img1.intrinsics
)
fps = f_count / (time.time() - t1)
cv2.putText(img, "FPS: %.2f" % (fps), (int(20), int(40)), 0, 5e-3 * 200, (0, 255, 0), 3)
cv2.namedWindow("img")
#cv2.moveWindow('img', 200, 20)
cv2.imshow('img', img)
if cv2.waitKey(5) & 0xFF == 27:
break
cv2.namedWindow("screen")
#cv2.moveWindow('screen', 1300, 500)
cv2.imshow('screen', screen)
if cv2.waitKey(5) & 0xFF == 27:
break