Skip to main content

AI Graphics Toolkit

Project description

1、使用方法

import cv2
import graphics as g

场景图识别

cl = g.Classifier(model_name="../models/classifier.pth", ctx_id=-1)
src = cv2.imread('27.png', cv2.IMREAD_UNCHANGED)
label = cl.predict(src)

场景图裁剪

src = cv2.imread('27.png', cv2.IMREAD_UNCHANGED)
ic = g.ImageCrop(model_name="../models/basnet.pth", ctx_id=-1)
image = ic.crop_image(src, (1000, 1000))
bbox = ic.crop_margin(src, (1000, 1000))

白底图裁剪

src = cv2.imread('27.png', cv2.IMREAD_UNCHANGED)
bbox = g.Graphics.crop_margin(src, thre=220, margin=[10, 10, 10, 10])

商品图镜像特效

src = cv2.imread('27.png', cv2.IMREAD_UNCHANGED)
image = g.Graphics.layer_reflection(src, top=0, down=0.3, transparency=0.15)

人物图蒙层特效

src = cv2.imread('27.png', cv2.IMREAD_UNCHANGED)
image = g.Graphics.layer_mask(src)

图像透明通道融合

src = cv2.imread('27.png', cv2.IMREAD_UNCHANGED)
image = g.Graphics.alpha_compose(src, image, x=0, y=0)

2、安装相关工具以及打包:

python -m pip install --user --upgrade setuptools wheel
python -m pip install --user --upgrade twine
python setup.py sdist bdist_wheel

3、在 https://pypi.org/https://test.pypi.org/ 注册账号 Cachcheng 并上传包

python -m twine upload --repository-url https://upload.pypi.org/legacy/ dist/*

4、查看pypi地址:

https://pypi.org/project/ai-graphics/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for ai-graphics, version 0.1.14
Filename, size File type Python version Upload date Hashes
Filename, size ai_graphics-0.1.14-py3-none-any.whl (32.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size ai-graphics-0.1.14.tar.gz (25.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page