正如bikz05所建议的那样,运行平均法在我的5个图像集上效果很好。谢谢你的提示 !
import cv2import numpy as npc = cv2.VideoCapture('test.avi')_,f = c.read()avg1 = np.float32(f)avg2 = np.float32(f)# loop over images and estimate background for x in range(0,4): _,f = c.read() cv2.accumulateWeighted(f,avg1,1) cv2.accumulateWeighted(f,avg2,0.01) res1 = cv2.convertScaleAbs(avg1) res2 = cv2.convertScaleAbs(avg2) cv2.imshow('img',f) cv2.imshow('avg1',res1) cv2.imshow('avg2',res2) k = cv2.waitKey(0) & 0xff if k == 5: break
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)