OutlineMapper


NameOutlineMapper JSON
Version 0.1.3 PyPI version JSON
download
home_pagehttps://github.com/RyuKaSa/OutlineMapper
SummarySimple outline mapper for images, using color clustering
upload_time2024-08-01 23:07:08
maintainerNone
docs_urlNone
authorRyukasa
requires_pythonNone
licenseNone
keywords
VCS
bugtrack_url
requirements numpy pillow matplotlib scikit-learn scipy
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # OutlineMapper

Simple outline mapper for images, using color clustering.

## Installation

You can install the package using pip:

```bash
pip install OutlineMapper
```

## Usage

```python
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".

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/RyuKaSa/OutlineMapper",
    "name": "OutlineMapper",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Ryukasa",
    "author_email": "william.bogdanovic@yahoo.fr",
    "download_url": "https://files.pythonhosted.org/packages/48/b6/1db70d35d020479beb54284142d81d7c38e3e3716339967d5f072eb652b8/OutlineMapper-0.1.3.tar.gz",
    "platform": null,
    "description": "# OutlineMapper\r\n\r\nSimple outline mapper for images, using color clustering.\r\n\r\n## Installation\r\n\r\nYou can install the package using pip:\r\n\r\n```bash\r\npip install OutlineMapper\r\n```\r\n\r\n## Usage\r\n\r\n```python\r\nfrom outline_mapper import process_image\r\nimport matplotlib.pyplot as plt\r\n\r\nimage_path = 'path/to/your/image.png'\r\nthreshold = 0.04\r\nmin_pixels = 100\r\nn_clusters = 5\r\n\r\n# Get the image with black outlines\r\noutlined_image = process_image(image_path, threshold, min_pixels, n_clusters, return_format=\"outlined_image\")\r\n\r\n# Get the mask\r\nmask = process_image(image_path, threshold, min_pixels, n_clusters, return_format=\"mask\")\r\n\r\n# Get the image with colored zones\r\ncolored_zones = process_image(image_path, threshold, min_pixels, n_clusters, return_format=\"colored_zones\")\r\n\r\n# Get the image with colored zones and black outlines\r\ncolored_zones_with_outlines = process_image(image_path, threshold, min_pixels, n_clusters, return_format=\"colored_zones_with_outlines\")\r\n\r\n# Display the results\r\nplt.figure(figsize=(24, 6))\r\n\r\nplt.subplot(1, 4, 1)\r\nplt.imshow(outlined_image)\r\nplt.title('Original Image with Outlines')\r\nplt.axis('off')\r\n\r\nplt.subplot(1, 4, 2)\r\nplt.imshow(mask)\r\nplt.title('Mask with Outlines')\r\nplt.axis('off')\r\n\r\nplt.subplot(1, 4, 3)\r\nplt.imshow(colored_zones)\r\nplt.title('Colored Zones')\r\nplt.axis('off')\r\n\r\nplt.subplot(1, 4, 4)\r\nplt.imshow(colored_zones_with_outlines)\r\nplt.title('Colored Zones with Outlines')\r\nplt.axis('off')\r\n\r\nplt.show()\r\n```\r\n\r\n## parameters\r\n\r\nParameters:\r\n\r\n - image_path (str): Path to the image file.\r\n - threshold (float): Threshold for color similarity.\r\n - min_pixels (int): Minimum number of pixels for a zone.\r\n - n_clusters (int): Number of clusters for K-means.\r\n - return_format (str): Format of the returned image. Options are \"outlined_image\", \"mask\", \"colored_zones\", and \"colored_zones_with_outlines\".\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Simple outline mapper for images, using color clustering",
    "version": "0.1.3",
    "project_urls": {
        "Homepage": "https://github.com/RyuKaSa/OutlineMapper"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "15b62c9bee29dae104cd3ec2d19f516e320bb286f1e184d1f46581525688a09b",
                "md5": "a19ab5da42bc1cf45df8dc681be2d40a",
                "sha256": "16e4477eb758bc98db43fd01411dbbd2baa655ce0ec665cac29f5f382018a6b2"
            },
            "downloads": -1,
            "filename": "OutlineMapper-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a19ab5da42bc1cf45df8dc681be2d40a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4697,
            "upload_time": "2024-08-01T23:07:07",
            "upload_time_iso_8601": "2024-08-01T23:07:07.516947Z",
            "url": "https://files.pythonhosted.org/packages/15/b6/2c9bee29dae104cd3ec2d19f516e320bb286f1e184d1f46581525688a09b/OutlineMapper-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "48b61db70d35d020479beb54284142d81d7c38e3e3716339967d5f072eb652b8",
                "md5": "e90fc90fd9fb1a4dc53330424b33c3b2",
                "sha256": "9c556bc5b6a7c503bcf2cccc70244427fd7b60788c2255341a1f41b4ec67e3d4"
            },
            "downloads": -1,
            "filename": "OutlineMapper-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "e90fc90fd9fb1a4dc53330424b33c3b2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4376,
            "upload_time": "2024-08-01T23:07:08",
            "upload_time_iso_8601": "2024-08-01T23:07:08.821573Z",
            "url": "https://files.pythonhosted.org/packages/48/b6/1db70d35d020479beb54284142d81d7c38e3e3716339967d5f072eb652b8/OutlineMapper-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-01 23:07:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "RyuKaSa",
    "github_project": "OutlineMapper",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": "pillow",
            "specs": []
        },
        {
            "name": "matplotlib",
            "specs": []
        },
        {
            "name": "scikit-learn",
            "specs": []
        },
        {
            "name": "scipy",
            "specs": []
        }
    ],
    "lcname": "outlinemapper"
}
        
Elapsed time: 0.47589s