python - Adding alpha channel to RGB array using numpy -


i have image array in rgb space , want add alpha channel zeros. specifically, have numpy array shape (205, 54, 3) , want change shape (205, 54, 4) additional spot in third dimension being 0.0's. numpy operation achieve this?

you use 1 of stack functions (stack/hstack/vstack/dstack/concatenate) join multiple arrays together.

numpy.dstack( ( your_input_array, numpy.zeros((25, 54)) ) ) 

Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -