Skip to main content

A sprite detection package

Project description

# Image Sprite Detection Module ## What is it? This is a Python module used for detection sprites from an image

## Why use this module? * Easy to use: You just need to pass an image an get the result * Time saving: This module is already built so you don’t need to spend time for it anymore!

## Usage: ####   Create a SpriteSheet object using: #####    SpriteSheet(fd, background_color=None):

@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.

####   Class SpriteSheet provides following methods:

#####    SpriteSheet.find_most_common_color(image):

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_image():

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_sprites():

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

## Installation: The project require Python 3.7+ to run

####   FOR USER: #####   In Terminal, use command:

pip3 install spriteutil_final

####   FOR DEVELOPMENT: #####   Clone or Downloads the project, using this command and then edit anything you want:

git clone https://github.com/intek-training-jsc/sprite-detection-longlamduc.git

## A Simple Example

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’)

## Contact:     During the usage of the project, if you have any question, please contact me personally at INTEK HCM City or via my email: long.lam@f4.intek.edu.vn

## Contributors:     Long LAM DUC from INTEK Institute, HCM City

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

spriteutil_final-1.5.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

spriteutil_final-1.5.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file spriteutil_final-1.5.0.tar.gz.

File metadata

  • Download URL: spriteutil_final-1.5.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7

File hashes

Hashes for spriteutil_final-1.5.0.tar.gz
Algorithm Hash digest
SHA256 16c05c2dfe7fa19275212dd92f44dc6ea303a18a9b0a1d942ca1bc5d8ee03ead
MD5 13567b72f98005f418f6c132bac727ea
BLAKE2b-256 cb817986504bdd90e9e210222f90c4e76a666b962ab823a9bc58ccba82ccaa45

See more details on using hashes here.

File details

Details for the file spriteutil_final-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: spriteutil_final-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7

File hashes

Hashes for spriteutil_final-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ddaede1be8a5f05b662e8dd45f726017194d7139164f3cb545c96716fd71d1bd
MD5 792e312095ee3816349c589bcdbc55db
BLAKE2b-256 f10fcd340908e8e6d7c17d5583e127d749feddd11fd2a89c8ccfd56b1a4fb8f0

See more details on using hashes here.

Supported by

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