質問編集履歴
1
回答をもらって修正したコードを追加した
test
CHANGED
File without changes
|
test
CHANGED
@@ -95,3 +95,99 @@
|
|
95
95
|
Python3.6
|
96
96
|
|
97
97
|
openCV3.4
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
### 回答をもらって変更したコード
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
```Python
|
106
|
+
|
107
|
+
import sys
|
108
|
+
|
109
|
+
import time
|
110
|
+
|
111
|
+
import csv
|
112
|
+
|
113
|
+
import cv2
|
114
|
+
|
115
|
+
import numpy as np
|
116
|
+
|
117
|
+
from threading import Thread
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
doga = "1.mp4"
|
124
|
+
|
125
|
+
b = 1
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
def func2(b):
|
130
|
+
|
131
|
+
for b in range(100000):
|
132
|
+
|
133
|
+
print("123123123")
|
134
|
+
|
135
|
+
print("END")
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
def func1(doga):
|
140
|
+
|
141
|
+
doga_path = doga
|
142
|
+
|
143
|
+
cap = cv2.VideoCapture(doga_path)
|
144
|
+
|
145
|
+
assert cap.isOpened(), 'Failed to open video file.'
|
146
|
+
|
147
|
+
cv2.namedWindow('Frame', cv2.WINDOW_NORMAL)
|
148
|
+
|
149
|
+
cv2.setWindowProperty('Frame', cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN)
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
ret, frame = cap.read()
|
154
|
+
|
155
|
+
while ret:
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
cv2.imshow('Frame', frame)
|
160
|
+
|
161
|
+
if cv2.waitKey(1) & 0xFF == ord('q'):
|
162
|
+
|
163
|
+
break
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
ret, frame = cap.read()
|
168
|
+
|
169
|
+
else:
|
170
|
+
|
171
|
+
print("---動画終了---")
|
172
|
+
|
173
|
+
cap.release()
|
174
|
+
|
175
|
+
cv2.destroyAllWindows()
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
if __name__ == '__main__':
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
p2 = Thread(target = func2(b))
|
184
|
+
|
185
|
+
p1 = Thread(target = func1(doga))
|
186
|
+
|
187
|
+
p2.start()
|
188
|
+
|
189
|
+
#event.set()
|
190
|
+
|
191
|
+
p1.start()
|
192
|
+
|
193
|
+
```
|