Skip to content

C++ project for finding the most frequent colors in an image and generating a color palette

License

Notifications You must be signed in to change notification settings

cadedupont/color-frequency-palette

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Color Frequency Palette

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.

Prerequisites:

  • g++ (C++ compiler)
  • Make
  • OpenCV

To run:

  1. Clone the repository by running the following in your machine's terminal:
    git clone https://github.com/cadedupont/color-frequency-palette.git
  2. Navigate to the directory containing the Makefile, which is the root directory of the project
  3. Run make to compile the program and generate the executable
  4. 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.

Output:

The program will generate two files in the res/out directory:

  1. <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
  2. <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)

Examples:

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

About

C++ project for finding the most frequent colors in an image and generating a color palette

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published