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.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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

mmcq_numba-0.0.3-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mmcq_numba-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 11.1 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.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f54cba7a4a398bb042858a603f18f02e0c9d459baef1034346c8360cf2e42ea1
MD5 20e808a6a67e53b2597c32cbd7ecf2ac
BLAKE2b-256 a2f6fbe61497891180099d337446a83dac6cac3a39e9a2833811a321acdc99a9

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