Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

What does the history of this function “createBackgroundSubtractorMOG2” means?

I only see this description in this link, it hasn't a very detailed explanation, so I'd like to know where can I find a more detailed explanation.The official web document says "Length of the history", what "Length of the history" is?

image description

My code:

import os
import time
import cv2

def main():
    img_src_dirpath = r'C:/Users/Shinelon/Desktop/SRC/'
    dir = r'D:/deal_pics/' + time.strftime('%Y-%m-%d') + '/'
    if not os.path.exists(dir):
        os.makedirs(dir)
    img_dst_dirpath = dir
    history = 60
    varThreshold = 16
    detectShadows = True
    mog2 = cv2.createBackgroundSubtractorMOG2( history, varThreshold, detectShadows )
    for f in os.listdir( img_src_dirpath ):
        if f.endswith( '.jpg' ):
            img = cv2.imread( img_src_dirpath + f )
            mog2.apply( img )
            bg = mog2.getBackgroundImage()
            cv2.imwrite( img_dst_dirpath + f, bg )
    cv2.destroyAllWindows()

if __name__ == '__main__':
    main()

What does the history of this function “createBackgroundSubtractorMOG2” means?

I only see this description in this link, it hasn't a very detailed explanation, so I'd like to know where can I find a more detailed explanation.The official web document says "Length of the history", what "Length of the history" is?

image description

My code:

import os
import time
import cv2

def main():
    img_src_dirpath = r'C:/Users/Shinelon/Desktop/SRC/'
    dir = r'D:/deal_pics/' + time.strftime('%Y-%m-%d') + '/'
    if not os.path.exists(dir):
        os.makedirs(dir)
    img_dst_dirpath = dir
    history = 60
    varThreshold = 16
    detectShadows = True
    mog2 = cv2.createBackgroundSubtractorMOG2( history, varThreshold, detectShadows )
    for f in os.listdir( img_src_dirpath ):
        if f.endswith( '.jpg' ):
            img = cv2.imread( img_src_dirpath + f )
            mog2.apply( img )
            bg = mog2.getBackgroundImage()
            cv2.imwrite( img_dst_dirpath + f, bg )
    cv2.destroyAllWindows()

if __name__ == '__main__':
    main()

What does the history of this function “createBackgroundSubtractorMOG2” means?

I only see this description in this link, it hasn't a very detailed explanation, so I'd like to know where can I find a more detailed explanation.The official web document says "Length of the history", what "Length of the history" is?

image description

My code:

import os
import time
import cv2

def main():
    img_src_dirpath = r'C:/Users/Shinelon/Desktop/SRC/'
    dir = r'D:/deal_pics/' + time.strftime('%Y-%m-%d') + '/'
    if not os.path.exists(dir):
        os.makedirs(dir)
    img_dst_dirpath = dir
    history = 60
    varThreshold = 16
    detectShadows = True
    mog2 = cv2.createBackgroundSubtractorMOG2( history, varThreshold, detectShadows )
    for f in os.listdir( img_src_dirpath ):
        if f.endswith( '.jpg' ):
            img = cv2.imread( img_src_dirpath + f )
            mog2.apply( img )
            bg = mog2.getBackgroundImage()
            cv2.imwrite( img_dst_dirpath + f, bg )
    cv2.destroyAllWindows()

if __name__ == '__main__':
    main()

What does the history of this function “createBackgroundSubtractorMOG2” means?

I only see this description in this link, it hasn't a very detailed explanation, so I'd like to know where can I find a more detailed explanation.The official web document says "Length of the history", what "Length of the history" is?

image description

My code:

import os
import time
import cv2

def main():
    img_src_dirpath = r'C:/Users/Shinelon/Desktop/SRC/'
    dir = r'D:/deal_pics/' + time.strftime('%Y-%m-%d') + '/'
    if not os.path.exists(dir):
        os.makedirs(dir)
    img_dst_dirpath = dir
    history = 60
    varThreshold = 16
    detectShadows = True
    mog2 = cv2.createBackgroundSubtractorMOG2( history, varThreshold, detectShadows )
    for f in os.listdir( img_src_dirpath ):
        if f.endswith( '.jpg' ):
            img = cv2.imread( img_src_dirpath + f )
            mog2.apply( img )
            bg = mog2.getBackgroundImage()
            cv2.imwrite( img_dst_dirpath + f, bg )
    cv2.destroyAllWindows()

if __name__ == '__main__':
    main()