2

I have a jpeg image and want to plot a histogram of how frequently each color occurs in the image. I am able to generate a frequency table using pymorph.histogram(), but I don't know the actual color that each of the 256 colors indices correspond to. How can I generate this palette?
Further, is there an way to just generate a histogram plot of all these numbers, with the colors indicated (not a number in the range 0-255, but the actual color displayed)?

My frequency list is generated using this code:

import pymorph
import Image

im=Image.open('image.jpg')
im=np.asarray(im)
hist_im=pymorph.histogram(im)
3
  • Note that from the documentation pymorph only handles grayscale or binary images. So each of the 256 values is simply a level of gray. Commented Feb 3, 2013 at 15:30
  • 2
    Take a look at this answer stackoverflow.com/questions/12182891/… Commented Feb 3, 2013 at 15:36
  • Thanks! I was wondering how 3 colors could be represented accurately in 256 values. I assumed there was a standard set of 256 colors which the image was reduced to. Commented Feb 3, 2013 at 18:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.