dimembermatt / ColorQuantization

C++ Program for quantizing colors in images using an implementation of the median cut algorithm.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ColorQuantization

Jan 2019

Matthew Yu C++ Program for quantizing colors in images using an implementation of the median cut algorithm.

Sunflower. Quantized Sunflower with 20 bins. Quantized Sunflower with 47 bins. Quantized Sunflower with 93 bins.

INSTRUCTIONS (ubuntu/linux):

  1. With the binary imgQuant and a /data folder with images in it
  2. run ./imgQuant
  3. type a file in /data to access (i.e. 'launch.png')
  4. enter a max bucket size (larger images tend to output a smaller percentage of bins than max)
  5. enter image scaling (>= 1, rec is 1|2)
  6. Quantized picture outputs!

OPTIONAL COMMANDS

After generating the picture, OfApp accepts the following commands by keyboard:

  • 's': saves the image under 'Color_Quant[i].jpg' (colors are inverted though for some reason)
  • 'r': reruns the program (enter in different input)
  • 'c': returns the credits and exits the program (Program can also be exited by ctrl+c in the console or esc in the window).

If you're interested at looking at the OF code for colorQuantizer to make this program, please contact me.

BUGS (OR FEATURES) to be fixed:

  1. Program crashes trying to load an invalid image. (currently no error checking for OF img.load(), although it can be fixed through checking the file path)
    • Solution: rerun the program again with valid image name.
  2. Program crashes when image scaling inputted is 0 or NaN. (typechecking and bounds checking upcoming).
    • Solution: input a number >= 1

About

C++ Program for quantizing colors in images using an implementation of the median cut algorithm.


Languages

Language:C++ 100.0%