A small example package
Project description
Sprites Detection
A sprite is a small raster graphic (a bitmap) that represents an object such as a character, a vehicle, a projectile, etc.
Sprite Sheet
It is not uncommon for games to have tens to hundreds of sprites. Loading each of these as an individual image would consume a lot of memory and processing power. To help manage sprites and avoid using so many images, many games use sprite sheets (also known as image sprites).
A sprite sheet consists of multiple sprites in one image. In other words, sprite sheets pack multiple sprites into a single picture. Using sprite sheet, video game developers create sprite sheet animation representing one or several animation sequences while only loading a single file:
Sprite Bounding Box
A frame (bounding box) can be used to delimit the sprite in the sprite sheet. This bounding box is defined with two 2D points top_left
and the bottom_right
, which their respective coordinates x
and y
are relative to the top-left corner of the sprite sheet's image.
Sprite Mask
The mask of a sprite defines the 2D shape of the sprite.
Aim of the project
- Detect sprites packed in an image (sheet) and draw their masks and bounding boxes into a new image with the same size of the original image.
- Present a 2D map of all the the sprites with their labels.
Installation
pipenv install spriteutil_detection
Features
Find sprites
- For example:
>>> from spriteutil_detection import SpriteSheet
>>> sprite_sheet = SpriteSheet('Barbarian.gif')
>>> sprites, labels = sprite_sheet.find_sprites()
>>> len(sprites)
39
Create sprites' masks and bouding boxes
- For example:
>>> from spriteutil_detection import SpriteSheet
>>> sprite_sheet = SpriteSheet('Barbarian.gif')
>>> # Create the mask image with bounding boxes.
>>> image = sprite_sheet.create_sprite_labels_image()
>>> image.save('barbarian_bounding_boxes.png')
Contact Information
- If you have any problems using this library, please use the contact below.
Email: duy.phung@f4.intek.edu.vn
Phone: (+84) 934 611 103
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for spriteutil_detection-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c66718fa17bc50f6ff8e5b01a82b446d05571fb4cac0c429d5fe907b673c8dc2 |
|
MD5 | 622c58e30f4449b523a5996e9d586bcd |
|
BLAKE2b-256 | 6756adf565d696bbb8195bc0d797bfa5b8b5a31ef250eae33cebb7751aa641e5 |
Hashes for spriteutil_detection-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0070f863f9085c46e1acf874871f4ae821b6f2be3963abb3abc8c37fcb42ae0 |
|
MD5 | 3691ac94ebbf653180a1def0af88109e |
|
BLAKE2b-256 | 95354fe22ec9c151c0fdae1c8b394ae7c804c5c1daec5b8c9e5d184c82b3c62a |