OutlineMapper
Simple outline mapper for images, using color clustering.
Installation
You can install the package using pip:
pip install OutlineMapper
Usage
from outline_mapper import process_image
import matplotlib.pyplot as plt
image_path = 'path/to/your/image.png'
threshold = 0.04
min_pixels = 100
n_clusters = 5
# Get the image with black outlines
outlined_image = process_image(image_path, threshold, min_pixels, n_clusters, return_format="outlined_image")
# Get the mask
mask = process_image(image_path, threshold, min_pixels, n_clusters, return_format="mask")
# Get the image with colored zones
colored_zones = process_image(image_path, threshold, min_pixels, n_clusters, return_format="colored_zones")
# Get the image with colored zones and black outlines
colored_zones_with_outlines = process_image(image_path, threshold, min_pixels, n_clusters, return_format="colored_zones_with_outlines")
# Display the results
plt.figure(figsize=(24, 6))
plt.subplot(1, 4, 1)
plt.imshow(outlined_image)
plt.title('Original Image with Outlines')
plt.axis('off')
plt.subplot(1, 4, 2)
plt.imshow(mask)
plt.title('Mask with Outlines')
plt.axis('off')
plt.subplot(1, 4, 3)
plt.imshow(colored_zones)
plt.title('Colored Zones')
plt.axis('off')
plt.subplot(1, 4, 4)
plt.imshow(colored_zones_with_outlines)
plt.title('Colored Zones with Outlines')
plt.axis('off')
plt.show()
parameters
Parameters:
- image_path (str): Path to the image file.
- threshold (float): Threshold for color similarity.
- min_pixels (int): Minimum number of pixels for a zone.
- n_clusters (int): Number of clusters for K-means.
- return_format (str): Format of the returned image. Options are "outlined_image", "mask", "colored_zones", and "colored_zones_with_outlines".
Metadata
Release files for OutlineMapper 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| OutlineMapper-0.1.3.tar.gz | 4.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| OutlineMapper-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.1 kB
Release files / OutlineMapper-0.1.3.tar.gz
| Download URL | OutlineMapper-0.1.3.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9c556bc5b6a7c503bcf2cccc70244427fd7b60788c2255341a1f41b4ec67e3d4
|
|
BLAKE2b-256 checksum How to use checksums |
48b61db70d35d020479beb54284142d81d7c38e3e3716339967d5f072eb652b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.5
|
Release files / OutlineMapper-0.1.3-py3-none-any.whl
| Download URL | OutlineMapper-0.1.3-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
16e4477eb758bc98db43fd01411dbbd2baa655ce0ec665cac29f5f382018a6b2
|
|
BLAKE2b-256 checksum How to use checksums |
15b62c9bee29dae104cd3ec2d19f516e320bb286f1e184d1f46581525688a09b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.5
|