def main():
if Display:
cap = cv2.VideoCapture(0)
out = cv2.VideoWriter('output.avi', -1, 2.0, (600, 440))
count = 0
while(count < 20):
ret, frame1 = cap.read()
ret, frame2 = cap.read()
frame1 = skimage.img_as_float(frame1)
frame2 = skimage.img_as_float(frame2)
output_img = optical_flow_ssd(frame1, frame2)
out.write(output_img)
cv2.imshow('frame', output_img)
count = count + 1
if cv2.waitKey(1) & 0xFF == ord('q'):
cap.release()
out.release()
cv2.destroyAllWindows()
break
else:
test()
评论列表
文章目录