Virtual Background for Webcam

What is a virtual background for a camera?

Everyone probably knows the program Zoom, which has a virtual background function. The program automatically finds a person in the frame and allows you to replace the space around them. In other words, a virtual background is like chromakey without the green screen.

How to use a virtual background in any application

There is a way to include a virtual background in any Windows application. Any virtual webcam that has the appropriate functionality will help. Let's look at the example of the AlterCam program, which you can download here. Note, The virtual background function will work in AlterCam if you have Windows 10 x64 or newer!

In short, it works like this. After you install AlterCam, another webcam appears in the system - a virtual one. You can select it instead of a real camera in any application. Then you can broadcast anything to the virtual webcam. For example, a video from a real webcam with a blurred or replaced background.

Virtual background options in AlterCam, with screenshots

In AlterCam, you can use the virtual background in several ways. For example, you can include any of dozens of effects just for the background. The most common is to use the "Blur" effect. Let's move on to the pictures. Here's a screenshot of the original video with no virtual background applied.

 

Before Applying the Virtual Background

 

Applying Effects for the Background

Notice the very first button on the "Effects" tab. It sets up a special mask of the automatically detected background for the effects to apply. By default, it automatically uses a blur effect. However, you can combine filters and turn on several at once. For example, in the screenshot below, "Blur" and "Hearts" filters are used.

 

Apply the effects to the background only

 

By the way, you can use the second button on the "Effects" tab to invert the mask. Then the effects will apply only to the person in the frame, and the background will remain unchanged. Maybe you need to hide just the face with the filter.

Replacing the Background

Now let's look at the options for changing the background in AlterCam. To do this, let's go to the "Background" tab. Here the virtual background is enabled with the checkbox. When this option is enabled, the background becomes transparent, and you need to choose what to put under the main video. By default, there is nothing to put under, and it looks like this:

 

Blank transparent background

 

A slider serves to adjust the load on the CPU. For example, if the FPS (frames per second) noticeably dropped when you enable the virtual background, you can move the slider to the right to reduce the load on the processor and reduce the precision of background-cutting. In most cases, you do not need to adjust anything. However, if you have a very high-resolution video and not the most efficient computer, you may have to move the slider to the right.

As you can see, there are several options for replacing the background. First, you can replace it with a fill of the color of your choice. However, it is not the best option because the AI artifacts may be visible on a solid-colored background. Second, you may replace the background with any selected picture. Finally, an exciting opportunity is to replace the background with a live video from your desktop. It helps conduct online lessons, webinars, presentations. Here's an example of replacing the desktop background in a live video from a webcam:

 

Replacing the background and overlay over the desktop video

 

The main video layer can be scaled and moved to the desired location in the frame with the mouse right in the preview area.

How the virtual background works

This paragraph is for those interested in the technical details of how automatic background separation works. In almost all implementations that we are aware of, the virtual background is based on a neural network trained to find a person in the frame in thousands of specially marked images. Of course, this neural network still needs to be optimized to work with video in real-time. AlterCam is not an exception. Automatic background detection is implemented using machine learning AI.

Do you have any questions? Ask us!