Skip to main content

mask2bbox

PyPI PyPI - Python Version PyPI - License PyPI - Downloads main

For a given mask, gets the coordinates of bounding box of each element of the mask. It will also allow for more operations in the future.

Installation

pip install mask2bbox

CLI

isolate-cells -h
isolate-cells-from-file -h
get-average-iou -h

Usage

import numpy as np
from mask2bbox import BBoxes

# Create a BBoxes object
all_boxes = BBoxes.from_mask("path/to/mask.png")

# Expand the bounding boxes
all_boxes = all_boxes.expand(n=10)

# Remove the bounding boxes that are located on the edge of the image
all_boxes = all_boxes.remove_from_edge()

# Get the sides of all the bounding boxes
sides = all_boxes.get("sides")

# Filter the bounding boxes by the sides
filtered_boxes = all_boxes.filter("sides", np.greater_equal, (35, 35))

# Get the IoU matrix of all the bounding boxes
iou = filtered_boxes.iou_matrix()

# Save the overlapping pairs to
filtered_boxes.save_overlapping_pairs("path/to/save/overlapping_pairs.csv")

# Save the IOU matrix to a csv file
filtered_boxes.save_iou_matrix("path/to/save/iou_matrix.csv")   

# Plot the bounding boxes on the mask image
filtered_boxes.draw(to="image", method="matplotlib", show="False", save="path/to/save/image.png")

# Save your bounding boxes
filtered_boxes.save_csv("path/to/bounding_boxes.csv")

# Get resize factors to resize the bounding boxes to a given size
resize_factors = filtered_boxes.de(desired_ratio=0.7, size=(256, 256))

# Extract the bounding boxes as images
filtered_boxes.extract(resize_factors, size=(256, 256), output="path/to/save/images")

License

mask2bbox offers a dual licensing mode the GNU Affero General Public License v3.0 - see LICENSE and ESSENTIAL_LICENSE_CONDITIONS.txt

Metadata

Release files for mask2bbox 0.0.28

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

Source distribution (sdist)

Source distribution for mask2bbox 0.0.28
File Size Uploaded Provenance Actions
mask2bbox-0.0.28.tar.gz 26.2 kB Without provenance Details for mask2bbox-0.0.28.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mask2bbox 0.0.28
File Interpreter ABI Platform Actions
mask2bbox-0.0.28-py3-none-any.whl Python 3 none any Details for mask2bbox-0.0.28-py3-none-any.whl

Total release size: 54.1 kB

Release files / mask2bbox-0.0.28.tar.gz

Download URL mask2bbox-0.0.28.tar.gz
Size 26.2 kB
Tags Source
SHA-256 checksum
How to use checksums
640be35a69bdb3cbc046c1efeb076079be5522799c2f0773043725da382acdcb
BLAKE2b-256 checksum
How to use checksums
24f2bd7886a82b9a4ca1b27424e5a7277b620a2ca1ae9d5f5e29d3d7ead81697
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.22

Release files / mask2bbox-0.0.28-py3-none-any.whl

Download URL mask2bbox-0.0.28-py3-none-any.whl
Size 27.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
467ea50f4a09c978e717729bf05d00eeee46106c94b9ce0c78c38b5234035d5f
BLAKE2b-256 checksum
How to use checksums
6b45910c58a9e6f1534de141831c70ba1116b360e2f4a9f67b4a312717a21044
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.22

Security for mask2bbox 0.0.28

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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