我正在尝试通过VANET创建基于擦除编码的视频流技术,我设法从凸轮流式传输视频并对其进行编码,现在我想在两个连续的帧上应用XOR操作并发送三个全部在一个数组中(三个表示每个帧及其连续的一个和XOR运算产生的帧) 这是我的代码:
import numpy as np
import cv,cv2
import cPickle as pickle
#cap for capturing the video
cap = cv2.VideoCapture(0)
f=open('videorecord.pkl', 'w')
vidrec = []
while(True):
#capture a frame from camera
ret, frame = cap.read()
# declare a list that will contain the frames
if ret==True:
cv2.imshow('Streaming a Video',frame)
#encode each frame
ret , frame1 = cv2.imencode('.jpeg' , frame)
# append it to the list
vidrec.append(frame1)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
else:
break
# add the list to the pkl file ...
pickle.dump(vidrec ,f , pickle.HIGHEST_PROTOCOL)
# realse everything
cap.release()
f.close()
cv2.destroyAllWindows()

请任何人帮助我吗?