Suppose I have a image with some dimension (1920, 1080, 3)
, I want to extract out R,G,B values into separate arrays R , G, B
. I tried to do it like
for i in range(image.shape[0]):
for j in range(image.shape[1]):
B = np.append(B, image[i, j][0])
G = np.append(G, image[i, j][1])
R = np.append(R, image[i, j][2])
But as expected this is very slow , How can I do this with numpy in built function?