Convert numpy tuple type into simple type

I have an array of tuples that represent RGBA. I want to move the tuple data to the 5th dimension. For example.

b=np.array([[[(50, 50, 50, 255), (55, 55, 55, 255), (57, 57, 57, 255),(52, 52, 52, 255)],
    [(46, 46, 46, 255), (51, 51, 51, 255), (53, 53, 53, 255),(55, 55, 55, 255)]],
   [[(50, 50, 50, 255), (51, 51, 51, 255), (52, 52, 52, 255),(50, 50, 50, 255)],
    [(55, 55, 55, 255), (59, 59, 59, 255), (59, 59, 59, 255),(55, 55, 55, 255)]],
   [[(50, 50, 50, 255), (46, 46, 46, 255), (46, 46, 46, 255),(46, 46, 46, 255)],
    [(58, 58, 58, 255), (59, 59, 59, 255), (55, 55, 55, 255),(49, 49, 49, 255)]],
   [[(48, 48, 48, 255), (40, 40, 40, 255), (39, 39, 39, 255),(40, 40, 40, 255)],
    [(56, 56, 56, 255), (52, 52, 52, 255), (48, 48, 48, 255),(46, 46, 46, 255)]]], 
    dtype=[('R', 'u1'), ('G', 'u1'), ('B', 'u1'), ('A', 'u1')])
print(b.shape)

and this prints (4,2,4). as you can see the tuple is NOT part of the shape. I want the shape to be (4,2,4,1,4) in which the final 4 is the RGBA data.

I tried:

c = np.apply_along_axis(lambda x: np.array(x), axis=0, arr=b)
d = c.reshape(b.shape + (1,4)) 

which fails (wrong number of elements). So i tried.

c = np.array([list(x) for x in b.ravel()])
d = c.reshape(b.shape + (1,4)) 

and it works! but I wonder if there is a better way?


recfunctions has a function to do this:

In [367]: b.shape
Out[367]: (4, 2, 4)
In [368]: b.dtype
Out[368]: dtype([('R', 'u1'), ('G', 'u1'), ('B', 'u1'), ('A', 'u1')])
In [369]: import numpy.lib.recfunctions as rf
In [370]: arr = rf.structured_to_unstructured(b)
In [371]: arr.shape
Out[371]: (4, 2, 4, 4)
In [372]: arr.dtype
Out[372]: dtype('uint8')

The comment method does the same thing:

In [373]: barr = np.array(b.tolist(), dtype="uint8")
In [374]: barr.shape
Out[374]: (4, 2, 4, 4)
In [375]: barr.dtype
Out[375]: dtype('uint8')