Skip to main content

This module provides functionality to count unique colors in an image represented as a NumPy array and, optionally, group their coordinates.

Tested against Windows / Python 3.11 / Anaconda

pip install colorcountcython

This module provides functionality to count unique colors in an image represented as a NumPy array and, optionally, group their coordinates. It includes a Cython-based implementation for improved performance.

Functions:
- colorcount(pic, coords=True, count=True):
  Count the unique colors in an image represented as a NumPy array. If `coords` is set to True, it also groups the coordinates of each color.

Internal Functions:
- _dummyimport():
  Internal function to check the availability of Cython.
- searchallcolors(pic, totallengthpic, width, withcoords, withcount):
  Cython function to count colors in an image and, if specified, group their coordinates.

Parameters:
- pic (ndarray): The input image represented as a NumPy array.
- coords (bool): If True, the function will return the coordinates of each unique color.
- count (bool): If True, the function will return the count of each unique color.

Returns:
A dictionary containing unique color information. If `coords` is True, it includes the coordinates of each color. If `count` is True, it includes the count of each color.

Note:
The `colorcount` function takes an image as input and returns a dictionary containing color counts and, if specified, color coordinates. The Cython-based implementation in this module enhances the performance of color counting.

Example:
	from a_cv_imwrite_imread_plus import open_image_in_cv
	from colorcountcython import colorcount
	b=open_image_in_cv('c:\\tetetete.png')
	d=colorcount(pic=b,coords=True, count=True)
	print(d)

Metadata

Release files for colorcountcython 0.10

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

Source distribution (sdist)

Source distribution for colorcountcython 0.10
File Size Uploaded Provenance Actions
colorcountcython-0.10.tar.gz 21.7 kB Without provenance Details for colorcountcython-0.10.tar.gz

Built distribution (wheel)

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

Total release size: 44.2 kB

Release files / colorcountcython-0.10.tar.gz

Download URL colorcountcython-0.10.tar.gz
Size 21.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f949e98ba171869166f6ee7126f274137770b134d5d70e41a1e9f4fdcc81a990
BLAKE2b-256 checksum
How to use checksums
7800fa6d9d7fbbd24c3a935d36a7d8c65dd395777c4ce9413316498e139007a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / colorcountcython-0.10-py3-none-any.whl

Download URL colorcountcython-0.10-py3-none-any.whl
Size 22.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8dcbf1c76bf83210995d40bdb709147e3246bd6a3094790b824eb69eaf8902c
BLAKE2b-256 checksum
How to use checksums
251e6fa7a1dedf510f4bebdb120a82bbd75a6edb832333765a4d8f263a56eb4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Security for colorcountcython 0.10

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.

Release history Release notifications | RSS feed

This release

0.10 This release

2 release files No provenance

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