1 | initial version |
First, you never actually create the subtractor object. You need to call the create function like so:
Ptr<BackgroundSubtractorMOG2> subtractor = createBackgroundSubtractorMOG2();
Secondly, you're never actually filling background. You need to get the background image by calling
subtractor->getBackgroundImage(background);