forked from moritzschaefer/kickercam
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreadstream.py
More file actions
48 lines (35 loc) · 975 Bytes
/
readstream.py
File metadata and controls
48 lines (35 loc) · 975 Bytes
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: Moritz
"""
import io
from collections import deque
import numpy as np
import cv2
import scipy
from image_processor import ProcessOutput
from goal_detector import GoalDetector
def main():
po = ProcessOutput()
gd = GoalDetector()
i = 0
videopath = './match2.h264'
camera = cv2.VideoCapture(videopath)
print(np.shape(camera))
(grabbed, frame) = camera.read()
while grabbed:
print("iteration", i)
is_success, buf = cv2.imencode(".jpg", frame, params=[cv2.IMWRITE_JPEG_QUALITY, 99])
io_buf = io.BytesIO(buf)
#frame = cv2.imdecode(buf, cv2.IMREAD_COLOR)
hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
# gd.step(hsv)
po.write(io_buf.getvalue())
cv2.imshow('image', hsv)
cv2.waitKey(1)
(grabbed, frame) = camera.read()
i += 1
cv2.destroyAllWindows()
if __name__ == "__main__":
main()