图像背景移除程序通过自动分割图像中的主体和背景并删除背景。这个过程涉及利用机器学习算法技术来检测前景和背景。
删除图片背景经常被用于:
下面是一些开源的图片背景移除开源程序。
源码:https://github.com/danielgatis/rembg
Rembg是一个可以移除图片背景的Python开源工具。Rembg还可以用作Python库,也可以支持GPU,运行起来更加高效。要安装它,请确保您的系统中安装了Python,然后运行:
# CPU Support
pip install rembg # for library
pip install rembg[cli] # for library + cli
# GPU Support
pip install rembg[gpu] # for library
pip install rembg[gpu,cli] # for library + cli
使用方式:
# 网络图片去除背景
curl -s http://input.png | rembg i > output.png
# 本地图片去除背景
rembg i path/to/input.png path/to/output.png
源码:https://github.com/nadermx/backgroundremover
官网:https://www.backgroundremoverai.com/
BackgroundRemover是个能够有效地消除图像或者视频背景的命令行工具。这个工具要求安装python >= 3.6、torch和torchvision稳定版本,以及ffmpeg 4.4+。
安装backgroundremover:
pip install backgroundremover
移除图片背景:
backgroundremover -i "/path/to/image.jpeg" -o "output.png"
移除视频背景:
backgroundremover -i "/path/to/video.mp4" -tv -o "output.mov"
移除视频背景并转GIF:
backgroundremover -i "/path/to/video.mp4" -tg -o "output.gif"
还有许多带参数的用法,有需要不防参考它的开源网站。
源码:https://github.com/imgly/background-removal-js
这是一个JavaScript脚本,可以直接在浏览器中轻松地从图像中删除背景,而不会产生任何额外的成本或隐私问题。
源码:https://github.com/darshitjain87/Image-Editor
Image-Editor是一个基于AI的照片编辑网站,提供了强大的图片编辑功能,如:背景更改、颜色调整、裁剪、图像锐化等。
它基于Python的cv2库的机器视觉算法实现图像处理,并利用Mediapipe的selfie_segmentation模型实现在视频流中的实时去除背景。
源码:https://github.com/OPHoperHPO/image-background-remove-tool
CarveKit是一个使用神经网络去除高质量图像中背景的自动化框架。
功能特征:
安装CPU版本:
pip install carvekit --extra-index-url https://download.pytorch.org/whl/cpu
安装GPU版本:
pip install carvekit --extra-index-url https://download.pytorch.org/whl/cu113
源码:https://github.com/FarjaalAhmad/django_bgRemoverML
这是一个集成Django的机器学习项目,用于从图像中移除背景。Linux安装过程如下:
git clone https://github.com/FarjaalAhmad/django_bgRemoverML
cd django_bgRemoverML
python3 -m pip install -r requirements.txt
bash setup.sh
python3 manage.py migrate
python3 manage.py runserver
通过向http://localhost:8000/upload发送POST请求,参数为:image=[BASE64]。
源码:https://github.com/plemeri/transparent-background
这是一个由InSPyReNet(ACCV 2022)提供并支持的图片背景删除工具。可以轻松地从图像、视频和其他视觉内容中删除背景。
源码:https://github.com/developersharif/bgremover-app
下载地址:https://sourceforge.net/projects/bgremover/
官网:https://bgremover.realbrain.cc/
这是一个离线的图像背景删除桌面应用程序。它利用最新的机器学习算法在几秒钟内提供准确的结果。只需拖放图像即可轻松编辑图像,一键去除背景。此外,应用程序还包括基本的编辑功能,例如更改图像背景和颜色。
如果觉得博客文章对您有帮助,异或土豪有钱任性,可以通过以下扫码向我捐助。也可以动动手指,帮我分享和传播。您的肯定,是我不懈努力的动力!感谢各位亲~