Simple outline mapper for images, using color clustering
Project description
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".
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
OutlineMapper-0.1.3.tar.gz
(4.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file OutlineMapper-0.1.3.tar.gz.
File metadata
- Download URL: OutlineMapper-0.1.3.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c556bc5b6a7c503bcf2cccc70244427fd7b60788c2255341a1f41b4ec67e3d4
|
|
| MD5 |
e90fc90fd9fb1a4dc53330424b33c3b2
|
|
| BLAKE2b-256 |
48b61db70d35d020479beb54284142d81d7c38e3e3716339967d5f072eb652b8
|
File details
Details for the file OutlineMapper-0.1.3-py3-none-any.whl.
File metadata
- Download URL: OutlineMapper-0.1.3-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16e4477eb758bc98db43fd01411dbbd2baa655ce0ec665cac29f5f382018a6b2
|
|
| MD5 |
a19ab5da42bc1cf45df8dc681be2d40a
|
|
| BLAKE2b-256 |
15b62c9bee29dae104cd3ec2d19f516e320bb286f1e184d1f46581525688a09b
|