Skip to main content

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

Release files for spriteutil-detection 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spriteutil-detection 1.0.2
File Size Uploaded
spriteutil_detection-1.0.2.tar.gz 6.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spriteutil-detection 1.0.2
File Interpreter ABI Platform
spriteutil_detection-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 14.6 kB

Release files / spriteutil_detection-1.0.2.tar.gz

Download URL spriteutil_detection-1.0.2.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7df63829b435e93855dd0183c1d9f4be11419c9a955c3cf9966042c3f888d4bf
BLAKE2b-256 checksum
How to use checksums
532cae3153ff728f72b35f604515e576b000282ee52bdee590d553bb70118463
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.6

Release files / spriteutil_detection-1.0.2-py3-none-any.whl

Download URL spriteutil_detection-1.0.2-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
78a9f30ee2be419baaeda759aac4b01df916c2d3d3b4deacb0bd60828b134632
BLAKE2b-256 checksum
How to use checksums
4ec0e1ffa058fdb98fee2d0d2e355b03bacd0321c40fbecc57c54091f93da99f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.6

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page