pip install -r requirements.txt
come into PrimaryColor.py
, then change the image path to yours, and run the code.
Blog url (Chinese language) https://blog.csdn.net/lhh31/article/details/52015500
- Obtain image RGB
- Convert RGB to HSV spatial values
- K-means iteration in HSV space (the initial point is randomly selected based on the pixel range of the image)
- Display image (convert the clustered HSV values to RGB for display)