Created
January 30, 2018 18:02
-
-
Save mboyanov/8a1a74c8f99a5571922fd5cefc1c8c58 to your computer and use it in GitHub Desktop.
Utility to copy the alpha channel from a 4d numpy image to a 3d numpy image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def copy_alpha(source, target): | |
new_shape = np.copy(target.shape) | |
new_shape[2] = 4 | |
fourd = np.zeros(new_shape, dtype=np.uint8) | |
fourd[:, :, 3] = source[:, :, 3] # copy the alpha channel | |
fourd[:, :, :3] = target[:, :, :3] #copy the content | |
return fourd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm having trouble integrating alpha_copy into neural_style.py. Could you please share the full script you used for the work you did here? Any help you could provide would be very much appreciated. Thanks!