A computer-implemented method comprising: receiving a plurality of frames of a video, wherein each frame includes depth data and color data for a plurality of pixels; downsampling the depth data and the color data of each frame of the plurality of frames of the video; after the downsampling, for each frame: based on the depth data, generating an initial segmentation mask that categorizes each pixel of the frame as foreground pixel or background pixel; detecting a head bounding box based on one or more of the color data or the initial segmentation mask; determining a trimap based on the initial segmentation mask that classifies each pixel of the frame, wherein the trimap respectively classifies the pixels of the frame as known background pixels, known foreground pixels, and unknown pixels, wherein determining the trimap comprises: generating a first trimap for non-head portions of the frame, wherein the non-head portions are portions of the frame that are outside the head bounding box, generating a second trimap for head portions of the frame, wherein the head portions are portions of the frame that are within the head bounding box, and wherein the second trimap is generated separately from the first trimap, and merging the first trimap with the second trimap; for each unknown pixel in the trimap, calculating a weight for the unknown pixel and storing the weight in a weight map; and performing fine segmentation based on the color data, the trimap, and the weight map to obtain a binary mask for the frame; and upsampling the binary mask of each frame of the plurality of frames, to obtain a foreground video. receiving a plurality of frames of a video, wherein each frame includes depth data and color data for a plurality of pixels; downsampling the depth data and the color data of each frame of the plurality of frames of the video; after the downsampling, for each frame: based on the depth data, generating an initial segmentation mask that categorizes each pixel of the frame as foreground pixel or background pixel; detecting a head bounding box based on one or more of the color data or the initial segmentation mask; determining a trimap based on the initial segmentation mask that classifies each pixel of the frame, wherein the trimap respectively classifies the pixels of the frame as known background pixels, known foreground pixels, and unknown pixels, wherein determining the trimap comprises: generating a first trimap for non-head portions of the frame, wherein the non-head portions are portions of the frame that are outside the head bounding box, generating a second trimap for head portions of the frame, wherein the head portions are portions of the frame that are within the head bounding box, and wherein the second trimap is generated separately from the first trimap, and merging the first trimap with the second trimap; for each unknown pixel in the trimap, calculating a weight for the unknown pixel and storing the weight in a weight map; and performing fine segmentation based on the color data, the trimap, and the weight map to obtain a binary mask for the frame; and based on the depth data, generating an initial segmentation mask that categorizes each pixel of the frame as foreground pixel or background pixel; detecting a head bounding box based on one or more of the color data or the initial segmentation mask; determining a trimap based on the initial segmentation mask that classifies each pixel of the frame, wherein the trimap respectively classifies the pixels of the frame as known background pixels, known foreground pixels, and unknown pixels, wherein determining the trimap comprises: generating a first trimap for non-head portions of the frame, wherein the non-head portions are portions of the frame that are outside the head bounding box, generating a second trimap for head portions of the frame, wherein the head portions are portions of the frame that are within the head bounding box, and wherein the second trimap is generated separately from the first trimap, and merging the first trimap with the second trimap; generating a first trimap for non-head portions of the frame, wherein the non-head portions are portions of the frame that are outside the head bounding box, generating a second trimap for head portions of the frame, wherein the head portions are portions of the frame that are within the head bounding box, and wherein the second trimap is generated separately from the first trimap, and merging the first trimap with the second trimap; for each unknown pixel in the trimap, calculating a weight for the unknown pixel and storing the weight in a weight map; and performing fine segmentation based on the color data, the trimap, and the weight map to obtain a binary mask for the frame; and upsampling the binary mask of each frame of the plurality of frames, to obtain a foreground video.