質問編集履歴
1
title
CHANGED
File without changes
|
body
CHANGED
@@ -7,33 +7,4 @@
|
|
7
7
|
書き方が悪いのだと思いますが、どのようにすれば良いでしょうか。
|
8
8
|
|
9
9
|
単純にPiCameraの動画を録画することは出来ますので、
|
10
|
-
OpenCVを使った方法をご教授ください。
|
10
|
+
OpenCVを使った方法をご教授ください。
|
11
|
-
|
12
|
-
```python
|
13
|
-
import cv2
|
14
|
-
import picamera
|
15
|
-
import picamera.array
|
16
|
-
|
17
|
-
fourcc = cv2.cv.CV_FOURCC('M','J','P','G')
|
18
|
-
out = cv2.VideoWriter('output.avi',fourcc,20.0,(1280,720))
|
19
|
-
with picamera.PiCamera() as camera:
|
20
|
-
with picamera.array.PiRGBArray(camera) as stream:
|
21
|
-
camera.resolution = (1280, 720)
|
22
|
-
|
23
|
-
while True:
|
24
|
-
camera.capture(stream, 'bgr', use_video_port=True)
|
25
|
-
# stream.array now contains the image data in BGR order
|
26
|
-
cv2.imshow('frame', stream.array)
|
27
|
-
out.write(stream.array)
|
28
|
-
if cv2.waitKey(1) & 0xFF == ord('q'):
|
29
|
-
break
|
30
|
-
# reset the stream before the next capture
|
31
|
-
stream.seek(0)
|
32
|
-
stream.truncate()
|
33
|
-
|
34
|
-
cv2.destroyAllWindows()
|
35
|
-
out.release()
|
36
|
-
|
37
|
-
```
|
38
|
-
|
39
|
-
よろしくお願い致します。
|