Python OpenCV背景扣除

Python OpenCV背景扣除,第1张

Python OpenCV背景扣除

正如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


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5663055.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存