Intensities histogram

Hello,

I am trying to make a histogram of a segmentation with 3 segments to know the intensities. I want to divide the histogram values by the number of pixels within each segment. Currently the histogram amplitudes are a function of the segmentation volume size. Any idea how can I do it?

Thanks!