Discarding alpha channel from images stored as Numpy arrays
问题 I load images with numpy/scikit. I know that all images are 200x200 pixels. When the images are loaded, I notice some have an alpha channel, and therefore have shape (200, 200, 4) instead of (200, 200, 3) which I expect. Is there a way to delete that last value, discarding the alpha channel and get all images to a nice (200, 200, 3) shape? 回答1: Just slice the array to get the first three entries of the last dimension: image_without_alpha = image[:,:,:3] 来源: https://stackoverflow.com/questions