我试图实现所谓的重影效果'从用于在OpenCV,Python中插入帧的LFI方法。
但是,输出似乎不会产生结果。我使用OpenCV的混合函数来计算它们之间的帧。
以下是代码:
from __future__ import division
import numpy as np
import cv2
cap = cv2.VideoCapture('test_vid.avi')
starting = True
prev_frame = np.uint8([250])
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
if starting==True:
prev_frame = frame
starting = False
else:
for i in range(1,10):
weight = i/10
#get the blended frames in between
mid_frame = cv2.addWeighted(prev_frame,weight,frame,1-weight,0)
cv2.imshow('frame2',mid_frame)
#cv2.imshow('frame',frame)
prev_frame = frame
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
结果似乎与当前帧的帧相同(没有任何实际混合的迹象)