Amn Kh - 7 months ago 37

Python Question

Suppose

`im`

`im = np.concatenate((`

im[:,:,0].reshape((100*100,)),

im[:,:,1].reshape((100*100,)),

im[:,:,2].reshape((100*100,))

),

axis=0

)

Now we have a row array with a size of

The question is that how we can get back from the concatenated image to the original one?

Answer

```
im = im.reshape(300,100)
s = np.zeros((100,100,3))
s[:,:,0] = im[:100,:]
s[:,:,1] = im[100:200,:]
s[:,:,2] = im[200:,:]
```

Source (Stackoverflow)