Skip to main content

A Sprite dectection tool

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:

Metal Slug Sprites

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.

For example:

Shape Bounding Boxes

Sprite Mask

The mask of a sprite defines the 2D shape of the sprite. For example, the sprite sheet contains 3 following sprites:

Metal Slug Standing Stance

The masks of these sprites are respectively:

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.

Usage Information

Prerequisites

  • Python 3.6 is required.
  • pip is requied, to install sudo apt install pip

Usage

  • pip install Friendlyngoc from your terminal

  • Example of functioning:

    • Input as a spritesheet '3.png'

    • A image with sprite masks 'spritesheet.png'

    >>> from Friendlyngoc_spriteutil.spriteutil import SpriteSheet
    >>> sprite_sheet = SpriteSheet('spritesheet.png')
    >>> sprites, labels = sprite_sheet.find_sprites()
    >>> len(sprites)
    22
    >>> # Create the mask image with bounding boxes.
    >>> image = sprite_sheet.create_sprite_labels_image()
    >>> image.save('sprites_masks.png')
    

Contact Information

  • Email: Email: ngoc.dang@f4.intek.edu.vn
  • Phone number: Phone: (+84) 90 690 2056

Project details


Download files

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

Source Distribution

Spriteutils_Ngoc_Dang-1.0.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Spriteutils_Ngoc_Dang-1.0.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file Spriteutils_Ngoc_Dang-1.0.0.tar.gz.

File metadata

  • Download URL: Spriteutils_Ngoc_Dang-1.0.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.8

File hashes

Hashes for Spriteutils_Ngoc_Dang-1.0.0.tar.gz
Algorithm Hash digest
SHA256 852074aee33741e5cc091951426fd16f1c92e46d8d1b73fc3a414d255176493c
MD5 0ad3f6bab56eff3fc984924ed183ac84
BLAKE2b-256 6f069d9985dcd0dc1f0a312659a5e15f10a6bd6f75ce4a1edfdd2a1066fbe19c

See more details on using hashes here.

File details

Details for the file Spriteutils_Ngoc_Dang-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: Spriteutils_Ngoc_Dang-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.8

File hashes

Hashes for Spriteutils_Ngoc_Dang-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9ddefbbb834128517daf0cab4342bab21f29af05568c4a118528fd10aec0fc61
MD5 9477611ccb038354d8324867fa029215
BLAKE2b-256 e11a82da3fbee3c0cb6833216795f2785a77529e3349752ebc75a886dbc0d4a4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page