Hi,

I need to compute the percentile of a histogram , but I'm not sure how to accomplish that. After computing the color histogram of an image I have an 256 size arrays that contains the distribution of pixel colors (Red ,

Green or Blue). Given a percentile , the number of pixels in the

image :n ,my idea was first to sort the vector increasingly and than

start adding the elements of the array until I got a sum closest to

p*n . The index of the array where I stopped adding was considered to

be the intensity color that matched the searched percentile. The

thing is that I'm really not sure whether this is correct , so any hints on this would be greatly appreciated.