-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
51 lines (30 loc) · 1.01 KB
/
main.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
38
39
40
41
42
43
44
45
46
47
48
import cv2 as cv
import tensorflow as tf
from keras.models import load_model
import pathlib
import warnings
from videostream import stream
import time
warnings.simplefilter(action='ignore', category=FutureWarning)
net=pathlib.Path('/home/christophe/Documents/code/projet dechet/neural_network.2.0.h5')
def predict(frame):
model=load_model(net)
#frame=np.resize(frame,(225,225,3))
def main_test():
cap=cv.cuda.VideoCapture(2)
start_time=0
frame_count=0
while 1:
if cap.isOpened():
ret,frame=cap.read()
cv.cuda.cvtColor(frame, cv.COLOR_BGR2RGB, dst=frame)
frame_count+=1
cv.imshow('flux video',frame)
elapsed_time = time.time() - start_time
fps = frame_count / elapsed_time
print(fps)
else :
print("error camera")
if cv.waitKey(1) == ord('q'):
break
main_test()