Depending on what your background actually is, there might be other ways to achieve your goal.
They are not automatic in the way you describe though.
(The more complex your background is, the more detail it has and the more similar it is to the foreground, the more complicated things will be, that is why greenscreens are used: one color, one even brightness across the frame, no features that can be ‘confused’ with the foreground)