C++ project for finding the most frequent colors in a given image, generating a palette of the 100 most frequent colors, and generating a csv file containing all colors found in the image and their frequency.
- g++ (C++ compiler)
- Make
- OpenCV
- Clone the repository by running the following in your machine's terminal:
git clone https://github.com/cadedupont/color-frequency-palette.git
- Navigate to the directory containing the Makefile, which is the root directory of the project
- Run
make
to compile the program and generate the executable - Run
./color_frequency <image_file>
from the root directory to run the program on the image of your choice (include file extension but exclude file path)
Included in the res/in
directory are some sample images of album covers I used to test the program. The program is hardcoded to look inside the res/in
directory for the image file, so if you want to use your own image, you'll need to move it into that directory.
The program will generate two files in the res/out
directory:
<image_file_name>.jpg
- a 1000x1000 image containing a palette of the 100 most frequent colors found in the provided image, with each color's hex code written on their respective block in the palette<image_file_name>.csv
- a csv file containing every color's RGB values, hex code, and frequency in the original image (sorted by frequency in descending order)
Album Cover |
Input Image |
Output Image |
Lahai - Sampha |
||
Wish You Were Here - Pink Floyd |
||
American Love Call - Durand Jones & The Indications |
||
This Old Dog - Mac DeMarco |