mmcq_numba
Faster MMCQ algorithm ( analyze dominant colors in image) with numba in python
Installation
pip install mmcq-numba
Usage
from mmcq_numba.quantize import mmcq
color_count = 8 # the number of dominant colors
quantize = 5
path = <path to image>
rgb = cv2.cvtColor(cv2.imread(path),cv2.COLOR_BGR2RGB)
width,height,c = rgb.shape
rgb_resize = cv2.resize(rgb, (width//quantize, height//quantize))
width,height,c = rgb_resize.shape
colors = rgb_resize.reshape(width*height, c).astype(np.int64)
# input type must be 2d arrays((size, channels)), and dtype=np.int64
c_map = mmcq(colors, color_count)
Reference
This project is based on mmcq.py
Metadata
Release files for mmcq-numba 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mmcq_numba-0.1.1.tar.gz | 9.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mmcq_numba-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.6 kB
Release files / mmcq_numba-0.1.1.tar.gz
| Download URL | mmcq_numba-0.1.1.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c9ec85374bb82e1b1caf394bf2ba17b7a80b4741fdd8d448f31c5077f60e5745
|
|
BLAKE2b-256 checksum How to use checksums |
26dc0137ead51e4efbd69c7ee553e81b260a76036e0fca9076b1c0bde7c2a4f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / mmcq_numba-0.1.1-py3-none-any.whl
| Download URL | mmcq_numba-0.1.1-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
87a1b35cf9a0b5349f39d804f775bc21675c52e634195763779743b54cf28719
|
|
BLAKE2b-256 checksum How to use checksums |
5d106ee6cfcaa840a06f229af587d9a972b6a1e65ad86519ff81954d4be788e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|