Skip to main content

Python library for cropping polygons in images

Project description

Poly_Crop

poly_crop is a Python library for cropping polygons in images.

Installation

You can install poly_crop via pip:

pip install poly_crop

Usage

Crop Function

The crop function is used to crop a polygonal region from an image.

from poly_crop import crop as pc

# Example usage
image_path = "path/to/your/image.jpg"
image = cv2.imread(image_path)
vertices = [(100, 100), (175, 50), (300, 100), (175, 150), (170, 100)]

cropped_image = pc.crop(image, vertices, resize=False)

Preview Function

The preview function is used to draw a preview of a polygonal region on an image.

from poly_crop import preview as pc

# Example usage
image_path = "path/to/your/image.jpg"
image = cv2.imread(image_path)
vertices = [(100, 100), (175, 50), (300, 100), (175, 150), (170, 100)]

preview_image = pc.preview(image, vertices, colour=(255, 0, 0), width=2)

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

poly_crop-0.4.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

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

poly_crop-0.4.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file poly_crop-0.4.0.tar.gz.

File metadata

  • Download URL: poly_crop-0.4.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.12

File hashes

Hashes for poly_crop-0.4.0.tar.gz
Algorithm Hash digest
SHA256 3d473db8c6eed04700f2dbf58a9f3ab55303ffa727ae161c6af0881f6236a651
MD5 3b109e17d34772ef6baee96a4b15c22e
BLAKE2b-256 ef1af150a6234549791f6c8cb9168984f0d6be67c9953808ad7904a50f9ba9ea

See more details on using hashes here.

File details

Details for the file poly_crop-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: poly_crop-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.12

File hashes

Hashes for poly_crop-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b8ff6034638399924f2f087612f5b8d74353a0c226337c18732fa10cc69d2a7a
MD5 c9aedf616f83e51b196a0cbf383ce32b
BLAKE2b-256 9d5c0d9246f896a9615c7f817f0aa6e03b583b7e77896b3eb42f91259c741600

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