OpenCV: how to use createBackgroundSubtractorMOG

前端 未结 4 501
太阳男子
太阳男子 2020-12-13 14:44

I was trying to go through this tutorial på OpenCV.org:

http://docs.opencv.org/trunk/doc/tutorials/video/background_subtraction/background_subtraction.html#backgroun

4条回答
  •  臣服心动
    2020-12-13 15:32

    Accordingly to the previous answer the background subtractor can be also defined as:

    BackgroundSubtractorMOG MOG;
    

    instead of:

    Ptr pMOG;
    pMOG= new BackgroundSubtractorMOG(); //MOG approach
    

    that would also require to delete pMOG when it is not used anymore, furthermore functor can be used to update foreground mask in a bit smarter way:

    MOG(newFrame, foregroundMask);
    

    insted of:

    pMOG->operator()(frame, fgMaskMOG);
    

    The default assumption of openCV is that the background is quite constant and does not need any update, so, after the learning initial phase the Mixture of Gaussians is not changed any more. A detailed and clear description can be also be found here:

    http://hal.archives-ouvertes.fr/docs/00/33/82/06/PDF/RPCS_2008.pdf

提交回复
热议问题