1

I am generating color pallete for image through octree quantization. Its gives me maximum 256 colors for any image. Now i want to show only top 10 ( according to the quantity of color in image ) colors of the image out of these 256 colors. How can i do this in c#?

Tom Rider
  • 2,747
  • 7
  • 42
  • 65

1 Answers1

1

Create a histogram, that is, count the number of pixels mapped to each color in the picture, then sort it in descending order and take the 10 first elements of the sorted array.

  • wait so you can write a program that does octree quantization but someone suggests sorting in descending order and you get stuck? Kudos youre like the opposite of every poster we get here xD you dont really need the histogram, thats more of a visual representation, just sorting the list of colours in descending order of pixel count then picking the ten at the top (the ones with the most pixels) would be good enough :P – RhysW Jul 19 '12 at 13:33