Skip to main content

A shape detection module for Python

Project description

# PyShapes:A Shape detection module for Python

[![Build Status](https://travis-ci.org/sudoRicheek/PyShapes.svg?branch=master)](https://travis-ci.org/sudoRicheek/PyShapes)

PyShapes is a python package that allows to detect and extract the basic shapes(polygons and circles) present in an image. It also has some in-built attributes and functions to get basic information and perform basic operations on those shapes.

This module uses Python OpenCV as dependency

### Installation

Installation is very simple through pip

For pip

` pip install PyShapes `

### Usage

Importing the package (Note : *You must import from PyShape not PyShapes*)

` from PyShape import * `

Creating PyShape objects -

` shapes = PyShape("C:\\path\\to\\image") `

Useful functions in PyShape -

  • Getting all the shapes detected in an image :

    ` shapes_dictionary = shapes.get_all_shapes() `

    Gets all the shapes in the image and returns a dictionary !

  • Displaying the shapes detected by providing coloured boundaries to them in original image :

    ` shapes.show_shapes() `

    Creates the coloured boundaries on top of the original image and displays the shape names along with the indexes

  • Getting the coordinates of the corners of a particular shape :

    ` numpy_array = shapes.get_corners("name of shape", index_of_shape) `

    Returns the coordinates of the corners of the shape in form of a numpy array

    Returns None if there is no shape with that name/index

  • Getting the area of a particular shape :

    ` area_of_shape = shapes.get_area("name of shape", index_of_shape) `

    Returns the area of a particular shape in pixel<sup>2 units; return type : double

    Returns -1 if there is no shape with that name/index

### About

The source is in the PyShape.py file.

Created By Richeek. Copyright 2020

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

PyShapes-1.1.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

PyShapes-1.1.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file PyShapes-1.1.1.tar.gz.

File metadata

  • Download URL: PyShapes-1.1.1.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/2.7.17

File hashes

Hashes for PyShapes-1.1.1.tar.gz
Algorithm Hash digest
SHA256 371bc7be355eda6c963f6e289c74df104d49ed623b4fe3e6df180a91ea57cacc
MD5 72b35377e5cef26df254e4076436aed5
BLAKE2b-256 c93ef993d51059432363b901abc7d6b715ebce586fc5dd7d27e69dd5e367b0fc

See more details on using hashes here.

File details

Details for the file PyShapes-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: PyShapes-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/2.7.17

File hashes

Hashes for PyShapes-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4918e8e4c2122cd9025e589e34b16ff4da12669c51a35b459a74919544cd89b7
MD5 7dea85f9571f63cd533fe5123d884e18
BLAKE2b-256 db52a696936afe212d1e13d0c43e889b081234420bc9de476f46e48ea0032287

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