I was looking for this exact thing, so I’ll just tell you what I found out if someone else is looking for it. The short answer seems to be no . At least it is not supported by OpenCV.
BackgroundSubtractorMOG2 inherits from BackgroundSubtractor, which inherits from the Algorithm, which has a built-in read / write function for storing algorithm parameters. According to the OpenCV document on Algorithm :: write , only parameters for algorithms of the background model are stored in it, and not the background model itself. Quote from the link:
“However, the background model is not saved. Firstly, it’s quite large. Then, if you saved the background model, it will most likely cease to be inappropriate the next time you start (due to changing the camera, changing the background, different lighting and etc ..) Therefore, BackgroundSubtractorMOG and BackgroundSubtractorMOG2 also rely on the standard :: write () algorithm to store only the algorithm parameters. "
OpenCV, , , , . , , , - , : , .