There is a software called Movavi Photo Editor which has a feature of background removal (subtraction) which works the following way: user marks areas of image which belong to an object and areas which belong to background
This actions provide clues to software how object and background look like and help to remove background of an image.
Example: https://img.movavi.com/movavi.com.12/images/how-to/en/how-to-remove-background-from-image/2.jpg
I'm interested in using similar technique in my OpenCV project for object detection. So I was wondering how this technique can be implemented in OpenCV?