Analyze dominant colors in image with MMCQ algorithm
Project description
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
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
mmcq_numba-0.1.1.tar.gz
(9.8 kB
view details)
Built Distribution
File details
Details for the file mmcq_numba-0.1.1.tar.gz
.
File metadata
- Download URL: mmcq_numba-0.1.1.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9ec85374bb82e1b1caf394bf2ba17b7a80b4741fdd8d448f31c5077f60e5745 |
|
MD5 | 67354e5b9db34bb6c8cb4c60862633e8 |
|
BLAKE2b-256 | 26dc0137ead51e4efbd69c7ee553e81b260a76036e0fca9076b1c0bde7c2a4f7 |
File details
Details for the file mmcq_numba-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: mmcq_numba-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87a1b35cf9a0b5349f39d804f775bc21675c52e634195763779743b54cf28719 |
|
MD5 | c7da1a8f9803cc50fd9b1f027229d414 |
|
BLAKE2b-256 | 5d106ee6cfcaa840a06f229af587d9a972b6a1e65ad86519ff81954d4be788e4 |