-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain3.py
More file actions
43 lines (35 loc) · 1.11 KB
/
main3.py
File metadata and controls
43 lines (35 loc) · 1.11 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
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.pipeline3 import Pipeline3
from calculators.HandsYolo.handsDectYolo import HandsDectYolo
if __name__=='__main__':
mp_drawing = mp.solutions.drawing_utils
pipe = Pipeline3()
cams = Cameras()
cams.captureRGBandDepth(0)
#cams.captureRGB(0)
f_count=0
t1=time.time()
while (True):
if f_count>30:
t1=time.time()
f_count=0
f_count+=1
#img = cams.getRGBFrame(0)
img,depth=cams.getRGBandDepthFrame(0)
img,screen = pipe.forward(img.colorframe,depthframe=depth,intrinsics=img.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.imshow('img', img)
if cv2.waitKey(5) & 0xFF == 27:
break
cv2.namedWindow("screen")
cv2.moveWindow('screen', 700,500)
cv2.imshow('screen', screen)
if cv2.waitKey(5) & 0xFF == 27:
break