Skip to main content

No project description provided

Project description

Sprite Sheet

Project Description

A sprite is a small raster graphic (a bitmap) that represents an object such as a character, a vehicle, a projectile, etc.

Sprites are a popular way to create large, complex scenes as you can manipulate each sprite separately from the rest of the scene. This allows for greater control over how the scene is rendered, as well as over how the players can interact with the scene.

Sprites are mainly used in 2D video games, such as Shoot'em up in which the hero combats a large number of enemies by shooting at them while dodging their fire.

Project Goal

  • Waypoint 1: Find the Most Common Color in an Image
  • Waypoint 2: Write a Class Sprite
  • Waypoint 3: Find Sprites in an Image
  • Waypoint 4: Draw Sprite Label Bounding Boxes
  • Waypoint 5: Write a Class SpriteSheet
  • Waypoint 6: Package and Distribute the Python Library

Project Benefit

Three main features of this project, more useful in Computer Vision:

  • Find the Most Common Color in an Image
  • Find Sprites in an Image
  • Draw Sprite Label Bounding Boxes

It can split your image with many sprites and you can improve it to work in Computer Vision.

Technology

  • Python (PIL, Numpy)

Project Team

  • Lam Khang Tran

Feature

Find the Most Common Color in an Image

Returns the pixel color that is the most used in this image.

Find Sprites in an Image

Returns a tuple (sprites, label_map) where:

  • sprites: A collection of key-value pairs (a dictionary) where each key-value pair maps the key (the label of a sprite) to its associated value (a Sprite object);

  • label_map: A 2D array of integers of equal dimension (width and height) as the original image where the sprites are packed in. The label_map array maps each pixel of the image passed to the function to the label of the sprite this pixel corresponds to, or 0 if this pixel doesn't belong to a sprite (e.g., background color).

Draw Sprite Label Bounding Boxes

Draws the masks of the sprites at the exact same position that the sprites were in the original image. Draws each sprite mask with a random uniform color (one color per sprite mask). Also draws a rectangle (bounding box) around each sprite mask, of the same color used for drawing the sprite mask.

Usage

Install packages: pillow (PIL), numpy, python 3.7.4

You have to install packages above:

pip install pillow

and

pip install numpy

Install New Python 3.7.4

Go to this link and download new python version: https://www.python.org/downloads/

Install my package

pip install spriteutilkangkang

Contact (Author & Maintainer)

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

spriteutilkangkang-1.0.0.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

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

spriteutilkangkang-1.0.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: spriteutilkangkang-1.0.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for spriteutilkangkang-1.0.0.tar.gz
Algorithm Hash digest
SHA256 555a6594fc2d1a20e5c8e99a43e82c98d57c186f93c948bcf97ba36e1446e1e6
MD5 32707a619f98363a71afb88e8b0422e1
BLAKE2b-256 46f84f2ca2049a50d3b87ed8715e2e6d290d3fc677a21756c74c8bec32ed2faa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: spriteutilkangkang-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for spriteutilkangkang-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 45488f49efc5b271ef4643d67ff2add4a01fbea8089c23a2b15b703e9a383bc0
MD5 a960b34c59fdf6e28e177866f66ba82a
BLAKE2b-256 003b14637474e0e8f3a0d9bd9bd06831861ca884531194fde66aeac152ba7cd0

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