-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enlarging images with alpha channel #18
Comments
I think it is possible. After reading images, only process the color channels with the ESRGAN model and directly copy (or maybe bicubic upsampling) the original alpha channel. After that, concatenate the color channels with the alpha channels, obtaining the final result. |
OpenCV seems to have support for reading an alpha channel, theres a cv2.IMREAD_COLOR flag that i've changed to cv2.IMREAD_UNCHANGED but sadly seems it nothing changed |
Having this supporting alpha channel on output would be awesome. Probably more of a BasicSR question but I was curious if using images with alpha channels would cause issues currently with training as well? |
I am not familiar with images with alpha channels. I do not know whether I understand correctly.
If possible, could you @shogun1337 @Dilapidated provide some example images with RGBA channels? I may have a try with current models ;-) |
@xinntao Sure, there are some texture samples with transparency from the "Return To Castle Wolfenstein" game |
@xinntao Thank you for looking into this deeper. I have included examples from two different games for variety/style purposes. Resident Evil 2 and New Super Mario Bros. |
I've found a new code that preserves alpha channel. I did a few testing and it works BUT it takes very long to process even on my GTX1080. |
@shogun1337 Can you post your image source so I can try it as well? |
I have tried it with this script https://pastebin.com/xUdTHff9 To control the noise and details, I also use the interpolation between |
@xinntao The results, at least for me, were expected to look like they do. |
@Fraggoso You can find this image in the pack i've posted ealier |
@xinntao I receive an error if I run the script: |
@Fraggoso |
Isn't it a way to simply ignore alpha channel and save the upscaled image without any alpha? That'd be good! |
Has there been any progress with this? Upscaling a game like Metroid Prime Trilogy will take forever without alpha channel handling. I can't even figure out how to programmatically sort the PNGs that are dumped by which ones have alpha and which ones don't, so I can process the ones with transparency with waifu2x-caffe, so I'd have to go through 10k+ images one by one and manually sort them. |
I have successfully converted all my RTCW/ET textures with ESRGAN and my own automated RTCWHQ method, see https://github.com/Krischan74/RTCWHQ |
@Krischan74 incredible work, thank you very much, this can be used for every other games aswell |
Thanks. I've created this for my "Enemy Territory Special Edition" (ETSE) which is still under construction / testing. It won't appear on Github but perhaps on moddb as it is LARGE (10GB!). At least the cool map launcher ETlaunch will be in my repository soon. Oh and many thanks to the guys from ESRGAN without ETSE wouldn't be possible. Before I found your cool project I upscaled thousands of textures MANUALLY in Photoshop with a special template I created. That looked already great but the ESRGAN results are even more stunning :-) |
Is it possible to edit the code so that you don't have to check if an image has alpha in them or not? |
If anyone else is interested in working with the alpha channel, you can look at my new repository, where I am creating a fork of the Real-ESRGAN with multi-channel support (essentially training with any number of channels, in particular 4-channel, with alpha channel support) |
Hello, is there any way to configure ESRGAN to preserve alpha (transparency) channel in png format images? It could be very useful when converting various textures with transparency for games. Best regards
The text was updated successfully, but these errors were encountered: