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

Uploaded Source

Built Distribution

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

Uploaded Python 3

Supported by

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