-
Notifications
You must be signed in to change notification settings - Fork 0
/
opencv_t_est.py
79 lines (52 loc) · 1.4 KB
/
opencv_t_est.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# -*- coding: utf-8 -*-
import sys
import cv2
import numpy as np
import threading
from time import sleep
import os
from PyQt5.QtCore import QUrl, QObject
from PyQt5.QtGui import QGuiApplication
from PyQt5.QtQuick import QQuickItem
from PyQt5.QtQml import qmlRegisterType, QQmlComponent, QQmlApplicationEngine, QQmlEngine, QQmlPropertyMap
import soloman
app = QGuiApplication(sys.argv)
# Create a QML engine.
#register()
engine = QQmlApplicationEngine()
engine.quit.connect(app.quit)
engine.load(QUrl('tests/exampl.qml'))
sol = soloman.Video(engine)
sol.get_SVideo('lover')
vid = soloman.Video(engine)
vid.get_SVideo('love')
# Capture
source = "ex/countdown640.mp4"
capture = cv2.VideoCapture(source)
cap = cv2.VideoCapture(0)
fgbg = cv2.createBackgroundSubtractorMOG2(50, 200, True)
def ok():
o_thread = threading.Thread(target=_ok)
o_thread.daemon = True
o_thread.start()
def _ok():
frameCount = 0
while True:
ret, frame = capture.read()
re, fran = cap.read()
frameCount += 1
if not re:
break
#resized = cv2.resize(frame, (0, 0), fx=0.5, fy=0.5)
#mask = fgbg.apply(resized)
"""cv2.imshow('frame', frame)
if cv2.waitKey(20) & 0xFF == 27:
break"""
sol.show_frame(frame)
vid.show_frame(fran)
soloman.fps_30()
ok()
app.exec_()
capture.release()
cv2.destroyAllWindows()
sys.exit(0)