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.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)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
mmcq_numba-0.0.2-py3-none-any.whl
(11.0 kB
view hashes)
Close
Hashes for mmcq_numba-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66eabb0aeeb60b8320d2f4f80af64a075cc8c27e2b466c66d69db181cdf12f1d |
|
MD5 | e1a35cd38b27769c682131205fe7123e |
|
BLAKE2b-256 | ba41661c93d66606b6a21a03cf266ff0dbdded3bded1ba7803a64ddfc3e36d10 |