allo-/virtual_webcam_background

Oversegmentation by default parameters

fangfufu opened this issue · 2 comments

The default parameters seem to oversegment my face. I can't see my ear and parts of my hair. I wonder if it is sensible to default back to original blog post's parameter.

Ah never mind, I saw the other isse. Just for the record, my parameters are:

segmentation_threshold: 0.75
blur: 30
erode: 0
dilate: 20
virtual_video_device: "/dev/video2"
real_video_device: "/dev/video0"
average_masks: 3
layers:
- "empty": [["image", "background.jpg"]]
- "foreground": []
multiplier: 0.75

These are pulled from https://github.com/fangfufu/Linux-Fake-Background-Webcam

allo- commented

The large blur factor is used for the hologram effect and no good idea for the simple background segmentation.

Have a look at this graphics here for erode and dilate: https://docs.opencv.org/3.4/db/df6/tutorial_erosion_dilatation.html

Using erode and dilate helps to erase smaller artifacts (e.g. when you have some small spot, it may vanish when the mask shrinks and then does not reappear when the mask is grown again). In the blog post, the parameters for the segmentation are dilate=10,erode=10 (See the beginning of the "Making it fun" section).

When the author implements the hologram effect, he instead uses dilate=10,blur=30 for the unsharp contour.
This is something that a hologram filter in the architecture of this program should probably add to the segmented image (blurring the alpha channel as well) instead of adding it to the mask.