Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

Python cv2.BackgroundSubtractorMOG2 history parameter doesn't work

$
0
0
I'm using opencv 2.4.11 with python 2.7.12. The BackgroundSubtractorMOG2 works (i.e. background subtraction results are ok), but I wanted to tune the parameters. However, changing the history parameter is not showing any changes the in the background subtraction results. Here is the code snippet: history = 30 #I've also tried 2,5,20,200 varThreshold = 16 bShadowDetection = False bgSub = cv2.BackgroundSubtractorMOG2(history, varThreshold, bShadowDetection) learningRate = 0.1 for currentFrame in allFrames: #assume allFrames is a list containing the images fgMask = bgSub.apply(currentFrame, None, learningRate) I've also tried setting the history using the `setInt` method: history = 30 #I've also tried 2,5,20,200 varThreshold = 16 bShadowDetection = False bgSub = cv2.BackgroundSubtractorMOG2(history, varThreshold, bShadowDetection) bgSub.setInt('history',30) learningRate = 0.1 for currentFrame in allFrames: #assume allFrames is a list containing the images fgMask = bgSub.apply(currentFrame, None, learningRate) Has anyone else had this problem or know what's going on?

Viewing all articles
Browse latest Browse all 19555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>