fixed bug with video sending

This commit is contained in:
ingvar1995 2017-06-13 21:50:00 +03:00
parent 6d705deb55
commit d1e90c6aef

View file

@ -292,17 +292,17 @@ class AV:
"""
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2YUV_I420)
y = frame[:self._video_height, :].tolist()
y = frame[:self._video_height, :]
y = list(itertools.chain.from_iterable(y))
u = np.zeros((self._video_width // 2, self._video_height // 2), dtype=np.int)
u[::2, :] = frame[self._video_height:self._video_height * 5 // 4, :self._video_height // 2]
u[1::2, :] = frame[self._video_height:self._video_height * 5 // 4, self._video_height // 2:]
u = np.zeros((self._video_height // 2, self._video_width // 2), dtype=np.int)
u[::2, :] = frame[self._video_height:self._video_height * 5 // 4, :self._video_width // 2]
u[1::2, :] = frame[self._video_height:self._video_height * 5 // 4, self._video_width // 2:]
u = list(itertools.chain.from_iterable(u))
v = np.zeros((self._video_width // 2, self._video_height // 2), dtype=np.int)
v[::2, :] = frame[self._video_height * 5 // 4:, :self._video_height // 2]
v[1::2, :] = frame[self._video_height * 5 // 4:, self._video_height // 2:]
v = np.zeros((self._video_height // 2, self._video_width // 2), dtype=np.int)
v[::2, :] = frame[self._video_height * 5 // 4:, :self._video_width // 2]
v[1::2, :] = frame[self._video_height * 5 // 4:, self._video_width // 2:]
v = list(itertools.chain.from_iterable(v))
return bytes(y), bytes(u), bytes(v)