Background estimation with OpenCV in Swift/ObjC

you can use getBackgroundImage() method of BackgroundSubtractor

see OpenCV: How to Use Background Subtraction Methods