Virtual Webcam
A program to replace the background in your webcam image

Configuration

The settings are configured in config.yaml and an example file is provided in the git repository.

The most important settings are:

You can edit most settings (except the devices and the device resolution) when the program is running and they will be applied instantly.

Next you should tune the separation. Start the program and use a video player like vlc to view your virtual webcam and set a background_image to see how good the foreground/background separation works.

Adjust segmentation_threshold between 0.0 and 1.0 to the value that works best for you.
To optimize the boundary, you can use dilate and erode. Dilate will grow the foreground mask by a number of pixels and erode will shrink it again. This helps to remove small spots of background that are recognized wrong. You will often get a slightly too large foreground, so you may want to set erode to a bit larger value than dilate.
To remove the artifacts around your body, you may blur the boundary a bit using the blur setting.

Finally you can optimize the mask update using the average_masks setting. A value of 1 means that only the current mask is used. This often leads to flickering in areas where the detection does not work good enough. By using a larger value you can reduce the flickering by averaging over the last few masks at the cost of getting afterimages when you move too fast. Usually 2 or 3 is a good value.

Settings that usually work fine:


Back to the homepage