I am attempting to create a Histogram with 8-bins. Each bin calculates the frequency of the RGB values given the following ranges:

bin1 0>=128,0>=128,0>=128
bin2 0>=128,0>=128,128>=256
bin3 0>=128,128?=256,0>=128
bin4 0>=128,128>=256,128>=256
bin5 128>=256,0>=128,0>=128
bin6 128>=256,0>=128,128>=256
bin7 128>=256,128>=256,0>=128
bin8 128>=256,128>=256,128>=256

My RGB values are:

123 23 34
23 43 223
12 34 56
231 32 112
123 12 42
23 233 44
223 34 23
33 26 29

The Histogram should show that bin1 Frequency is 4, bin 2 & bin 3 = 1, and bin5 = 2.

I know how to create a histogram and how to define a standard range for bins; however, how do I implement the ranges for bins1-8 listed above? Eventually I also want to implement 64-bins and 512-bins.