Skip to main content

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


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

OutlineMapper-0.1.3-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

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

Hashes for OutlineMapper-0.1.3.tar.gz
Algorithm Hash digest
SHA256 9c556bc5b6a7c503bcf2cccc70244427fd7b60788c2255341a1f41b4ec67e3d4
MD5 e90fc90fd9fb1a4dc53330424b33c3b2
BLAKE2b-256 48b61db70d35d020479beb54284142d81d7c38e3e3716339967d5f072eb652b8

See more details on using hashes here.

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

Hashes for OutlineMapper-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 16e4477eb758bc98db43fd01411dbbd2baa655ce0ec665cac29f5f382018a6b2
MD5 a19ab5da42bc1cf45df8dc681be2d40a
BLAKE2b-256 15b62c9bee29dae104cd3ec2d19f516e320bb286f1e184d1f46581525688a09b

See more details on using hashes here.

Supported by

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