雪碧探测包
spriteutil-final的Python项目详细描述
图像精灵检测模块 ##这是什么? 这是一个Python模块,用于从图像中检测精灵
为什么要使用此模块? *易于使用:您只需要传递一个图像就可以得到结果 *{/str}不需要再为这个模块节省时间了!在
使用方法: ####使用以下方法创建精灵表对象: #####&;ensp;nbsp;SpriteSheet(fd,背景颜色=无):
@fd: the name and path (a string) that references an image file in the local file system; OR a pathlib.Path object that references an image file in the local file system ; a file object that MUST implement read(), seek(), and tell() methods, and be opened in binary mode; OR a Image object.
@background_color: an integer if the mode is grayscale; OR a tuple (red, green, blue) of integers if the mode is RGB; OR a tuple (red, green, blue, alpha) of integers if the mode is RGBA. The alpha element is optional. If not defined, while the image mode is RGBA, the constructor considers the alpha element to be 255.
类精灵表提供了以下方法:
恩斯普;精灵表。找到最常见的颜色(图片):
Find most used color in an Image object arg: image: MUST be an Image object Return most used color in the image with the same format image’s mode
恩斯普;SpriteSheet.object.create_sprite_labels_图像():
Create a mask image of initial image, and add a bounding box around each sprite, each sprite also have an unique random uniform color. Return an Image object.
恩斯普;SpriteSheet.object.find_精灵():
Detect sprites inside the image Return a 2D label map and a dict that stores: key: sprite’s label value: its Sprite’s object arg: image: MUST be an Image object
##安装: 该项目需要python3.7+才能运行
对于用户: #####在终端中,使用命令:
pip3 install spriteutil_final
促进发展: #####使用此命令克隆或下载项目,然后编辑所需的任何内容:
git clone https://github.com/intek-training-jsc/sprite-detection-longlamduc.git
一个简单的例子
from spriteutil_final.spriteutil import SpriteSheet spritesheet = SpriteSheet(‘islands.png’) sprites, label_map = spritesheet.find_sprites() img_mask = spritesheet.create_sprite_labels_image() img_mask.save(‘islands_label_mask.png’) img_mask_with_border = spritesheet.make_sprite_border_image() img_mask.save(‘islands_label_mask_with_border.png’)
联系方式: &;emsp;amp;emsp;在项目使用过程中,如果您有任何问题,请通过INTEK HCM City亲自联系我或通过我的电子邮件:long.lam@f4.intek.edu.vn
贡献者: &来自HCM市INTEK Institute的Long LAM DUC
- 项目
标签: