雪碧探测包

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

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
Oracle Java:NLS_区域是否足以正确格式化数字?   java开放Api$ref以使用url   如何在java中使用synchronized方法实现线程的同步?   java无法创建JVM Android studio   使用基本Java检查两个字符串是否是彼此的字谜   spring:如何将java安全配置转换为yml   java如何扩展任何移动服务提供商的SMSC?   如何转换java。util。日期到soap支持的日期格式“yyyyMMdd'T'HH:mm:ss”,带区域id   java Hibernate:中间关系   java从main中的其他类调用方法   java找出由两个长历元值表示的两个日期之间的差异   java更新cloudera quickstart vm以使用java7   java jOOQ将字符串转换为布尔值   java定制Android Spinner XML w/SpinnerAdapter?