DeadSix27 / waifu2x-converter-cpp

Improved fork of Waifu2X C++ using OpenCL and OpenCV
MIT License
792 stars 86 forks source link

Faint white border around sprites (alpha images) #183

Closed kcghost closed 4 years ago

kcghost commented 5 years ago

I have found that waifu2x-converter-cpp can't really be used on game sprites, because while it produces a mostly transparent image, a faint border of white can still be seen around the sprite. Easily seen here when over a black background: headd1

I gather some tricky method must be used, because the model itself doesn't handle alpha? Not sure exactly what the best method is, but I know waifu2x-chainer handles this better and does some logic around splitting the alpha and doing...something with it. The end result from waifu2x-chainer isn't perfect either, it ends up blending with the alpha abit more than it should, but doesn't get a border and is directly usable, especially with some post-processing.

Not sure if it applies to waifu2x, but I have seen output from Nvidia gameworks and other AI scalers that simply don't handle the alpha layer at all and the image bleeds out from the sprite making a blurry mess in the once-transparent areas. Even a mode like that might be useful, cause a mask to cut out the sprite can be generated with xbrz or another scaler that handles transparency well.

YukihoAA commented 4 years ago

it maybe caused by border pixel but it is spec of waifu2x-converter-cpp's algorithm.

suggest to use other algorithms for that. sorry.