0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Linuxでもバーチャル背景を実現する

Posted at

環境

  • Arch linux
  • ハードオフで拾ってきたジャンクのWebカメラ

Linux-Fake-Background-Webcamを導入する

  1. fake-background-webcam-gitをAURからダウンロードしてビルド・インストールする。
  2. v4l2-loopbackが入っていなかったら入れる。
  3. お好みのファイルに以下のコンフィグを記述。
  4. 解像度などはv4l2-ctl -d /dev/video0 --allなどして適宜調整する。
  5. sudo modprobe v4l2loopback devices=1する。
  6. sudo python /usr/lib/fake-background-webcam/fake.py -c (コンフィグファイルの絶対パス)で起動する。
  7. お好みのアプリケーションでバーチャルカメラの設定をする。
  8. 楽しむ。
# https://pypi.org/project/ConfigArgParse/

#Set real webcam width
width=640

#Set real webcam height
height=480

#Set real webcam FPS
fps=30

#Set real webcam codec
codec='MJPG'

#Set real webcam path
webcam-path="/dev/video0"

#V4l2loopback device path
v4l2loopback-path="/dev/video2"

#Disable background image and blur the real background
#no-background=true

#Background image path, animated background is supported.
#background-image=background.jpg
background-image=/var/lib/fake-background-webcam/default/background.jpg

#Tile the background image
#tile-background=true

#The gaussian bluring kernel size in pixels
#background-blur=21

#The fraction of the kernel size to use for the sigma value (ie. sigma = k / frac)
#background-blur-sigma-frac=3

#Crop background if needed to maintain aspect ratio
#background-keep-aspect=true

#Disable foreground image
#no-foreground=true

#Foreground image path
foreground-image=/var/lib/fake-background-webcam/default/foreground.jpg

#Foreground mask image pat
foreground-mask-image=/var/lib/fake-background-webcam/default/foreground-mask.png

#Add a hologram effect
#hologram=true

#Continue processing when there is no application using the virtual webcam
no-ondemand=true

#The running average percentage for background mask updates
background-mask-update-speed=100

#Force the mask to follow a sigmoid distribution
#use-sigmoid=true

#The minimum percentage threshold for accepting a pixel as foreground
threshold=50

#Disable postprocessing (masking dilation and blurring)
no-postprocess=true

#Select the model for MediaPipe. For more information, please refer to https://github.com/fangfufu/Linux-Fake-Background-Webcam/issues/135#issuecomment-883361294
select-model=0

#Apply colour map to the person using cmapy. For examples, please refer to https://gitlab.com/cvejarano-oss/cmapy/blob/master/docs/colorize_all_examples.md
#cmap-person=

#Apply colour map to background using cmapy
#cmap-bg=

おわり

スクリーンショット_2021-10-22_02-08-44.png

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?