Skip to main content

PolygonAreaSegmentation

Overview

The meaPolygon function calculates the area of polygons based on coordinates provided in a text file and corresponding image dimensions. This function is useful for tasks where polygonal regions of an image need to be analyzed, such as in image segmentation or object detection.

Additionally, this function is designed to work with text files formatted for semantic segmentation in the YOLO format. This means that it can accurately process polygon coordinates that are normalized relative to image dimensions, as commonly used in YOLO-based object detection and segmentation tasks.

PyPI version GitHub stars GitHub issues GitHub license Main Project

Original Yolo format Semantic Segmentation

Original                                                                         Yolo format Semantic Segmentation

Installation

First, install the necessary dependencies. After cloning or downloading this project, run the following command to install the package:

pip3 install .
pip install meaPolygon

This will install the module containing the meaPolygon function, making it available for use in your Python environment.

Usage

  1. Prepare the YOLO Format Text File Prepare a text file formatted for YOLO semantic segmentation. Each line should contain a label and normalized polygon coordinates.

Example:

0 0.1 0.2 0.3 0.4 0.5 0.6
1 0.2 0.3 0.4 0.5 0.6 0.7
  1. Create a Python Script
from meaPolygon import meaPolygon

# Specify the paths to the image file and the text file
img_path = "examples/data/example.png"
txt_path = "examples/data/example.txt"

# Calculate the polygon areas
areas = meaPolygon(img_path, txt_path)

# Display the results
print("Calculated Polygon Areas:", areas)
  1. Run the Script
python3 your_script.py
  1. Expected Output When you run the script, you should see output similar to the following, depending on the content of your text file and image dimensions:
Calculated Polygon Areas: [15.34, 28.92, 35.76]

Each value in the list corresponds to the area of a polygon defined in the text file. The values are in square units based on the dimensions of the input image.

Contact & Support

f you have any questions, issues, or suggestions, please feel free to contact us:

For more detailed discussions, bug reports, or feature requests, please open an issue on the GitHub repository. We appreciate your feedback and contributions!

Metadata

Release files for meaPolygon 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for meaPolygon 0.0.7
File Size Uploaded
meaPolygon-0.0.7.tar.gz 4.9 kB Details

Release files / meaPolygon-0.0.7.tar.gz

Download URL meaPolygon-0.0.7.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7c716f144730752569ab22d9e1b0f82c23f219ad8a8cd872642a3c019e50f9ed
BLAKE2b-256 checksum
How to use checksums
7eb70bd74c3fc7223659db9a2b091ed307761c66297381a3fb27ad67be2956c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.0.7 This release

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page