更新 README.md
This commit is contained in:
parent
d5760b0e6f
commit
f031abc316
@ -1,16 +1,16 @@
|
|||||||
# <p align="center">图像二值化处理</p>
|
# <p align="center">图像二值化处理</p>
|
||||||
## 运行库
|
## 运行库
|
||||||
cv2、matplotlib、PIL、rembg<br>
|
cv2、matplotlib、PIL、rembg<br>
|
||||||
onnxruntime(rembg需要用到此库)
|
onnxruntime(rembg需要用到此库)
|
||||||
## rembg库
|
## rembg库
|
||||||
这个库可以对图像中的主体进行抠图处理,去掉背景仅保留人物/动物等。<br>
|
这个库可以对图像中的主体进行抠图处理,去掉背景仅保留人物/动物等。<br>
|
||||||
初次运行代码会自动下载v2net.onnx模型文件(必须),模型文件大小为176M。安装这个模型需要进行魔法上网。<br>
|
初次运行代码会自动下载v2net.onnx模型文件(必须),模型文件大小为176M。安装这个模型需要进行魔法上网。<br>
|
||||||
rembg[`仓库`](https://github.com/danielgatis/rembg)地址
|
rembg[`仓库`](https://github.com/danielgatis/rembg)地址
|
||||||
## 二值化处理
|
## 二值化处理
|
||||||
```c
|
```c
|
||||||
_, binary_image = cv2.threshold(image, 1, 255, cv2.THRESH_BINARY)
|
_, binary_image = cv2.threshold(image, 1, 255, cv2.THRESH_BINARY)
|
||||||
```
|
```
|
||||||
将图像灰度值 > 1的像素变为255(白色),也就是将抠图后保留的部分完全设为白色。其他区域像素全为0(黑色)。
|
将图像灰度值 > 1的像素变为255(白色),也就是将抠图后保留的部分完全设为白色。其他区域像素全为0(黑色)。
|
||||||
## 结果展示
|
## 结果展示
|
||||||
原图、抠图后的图片、二值化处理抠图后的图片的图片<br>
|
原图、抠图后的图片、二值化处理抠图后的图片的图片<br>
|
||||||

|

|
||||||
|
Loading…
x
Reference in New Issue
Block a user