Skip to content

Latest commit

 

History

History
19 lines (16 loc) · 832 Bytes

README.md

File metadata and controls

19 lines (16 loc) · 832 Bytes

Image main color extraction, iterative realization in k-means hsv

Installation Environment

pip install -r requirements.txt

Usage

come into PrimaryColor.py, then change the image path to yours, and run the code.

Results show

image image

main steps, details see the blog

Blog url (Chinese language) https://blog.csdn.net/lhh31/article/details/52015500

  1. Obtain image RGB
  2. Convert RGB to HSV spatial values
  3. K-means iteration in HSV space (the initial point is randomly selected based on the pixel range of the image)
  4. Display image (convert the clustered HSV values to RGB for display)