I tried to create a normalized matrix of size 256*256*3 which represent the RGB cube like this,

I tried the following code in opencv-(I imported numpy as np):
R = [np.true_divide(i, 256) for i in xrange(256)]
RGB_Cube = np.zeros((256, 256, 3), dtype=np.float64)
RGB_Cube[:, :, 0] = RGB_Cube[:, :, 1] = RGB_Cube[:, :, 2] = np.tile(R, (256,1))
and I got this:

I also tried this(without normalizing the channels):
R = [i for i in xrange(256)]
# R = np.linspace(0, 1, 256, endpoint=True)
RGB_Cube = np.zeros((256, 256, 3), dtype=np.float64)
RGB_Cube[:, :, 0] = RGB_Cube[:, :, 1] = RGB_Cube[:, :, 2] = np.tile(R, (256,1))
but I got a white image.
I want to partition this matrix into sub-cuboids. Then finding the mean value of these cuboids. After that I will use this information for segmentation of a given image!
I don't know how much easy this problem is, I couldn't find a way to solve it. Can anyone help?
Thanks