Skip to main content

Analyze dominant colors in image with MMCQ algorithm

Project description

mmcq_numba

Faster MMCQ algorithm ( analyze dominant colors in image) with numba in python

results

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.0.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

mmcq_numba-0.1.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file mmcq_numba-0.1.0.tar.gz.

File metadata

  • Download URL: mmcq_numba-0.1.0.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for mmcq_numba-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7150bbdc0735466954c6fa1d0574b4566458e3dbf75ed60daab9d10a348c5007
MD5 757b69164e83dad0a443f948b6b6fbac
BLAKE2b-256 b8398f8958c826c77052d7de8fe5dc0fc01c6be5bf91ff8ed3e0e1f1247fda02

See more details on using hashes here.

File details

Details for the file mmcq_numba-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mmcq_numba-0.1.0-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

Hashes for mmcq_numba-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d914c9d7c14e028a4d97c08cfb8211e5986884a3c6230d02cd38a076b6adc2d0
MD5 dd29f99bbb75e6f41ec60c9c8df6dd5f
BLAKE2b-256 2c86fdde44f5a2efc107911cc867b4920e55bdaa2bedc39c7698be24d8dece4a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page