View Full Version : Another little upscale script
Dark Shikari
15th October 2008, 23:57
So I needed to upscale an RGB image with some sharp lines, and Lanczos really wasn't doing the job. I fooled around with a few filters, and came up with this:
image=ImageSource("source.bmp")
r=image.ShowRed("YV12").nnediresize_YV12().dehalo_alpha().fastlinedarken().LimitedSharpenFaster()
g=image.ShowGreen("YV12").nnediresize_YV12().dehalo_alpha().fastlinedarken().LimitedSharpenFaster()
b=image.ShowBlue("YV12").nnediresize_YV12().dehalo_alpha().fastlinedarken().LimitedSharpenFaster()
MergeRGB(r,g,b)
Source (http://i35.tinypic.com/2a01gf6.jpg)
2x upscale, GIMP Lanczos (http://i33.tinypic.com/vigsqu.png)
2x upscale, above script (http://i35.tinypic.com/wt9jbs.png)
mikeytown2
16th October 2008, 01:38
Simple & slow and from the looks of it, very effective.
I just tried converting it to a vector image (Potrace), upscaling it, then back to raster. Results suck.
http://wiki.inkscape.org/wiki/index.php/Tools#Vectorize.2Ftrace
CYMK color space instead of RGB for nnedi isn't as good either.
http://img139.imageshack.us/img139/1161/cymknnedimy7.th.png (http://img139.imageshack.us/my.php?image=cymknnedimy7.png)http://img139.imageshack.us/images/thpix.gif (http://g.imageshack.us/thpix.php)
Ran 4 times, once for each channel. Used Gimp for CYMK conversions.
ImageReader("CYMK.png",0,1,pixel_type="RGB32").AddBorders(0,1,0,0).ConvertToYV12()
nnediresize_YV12().dehalo_alpha().fastlinedarken().LimitedSharpenFaster().ConvertToRGB32().Crop(0,1,0,-1)
function nnediresize2x(clip c, bool pY, bool pU, bool pV)
{
v = c.nnedi(1, dh=true,Y=pY,U=pU,V=pV).turnleft()
v = v.nnedi(1, dh=true,Y=pY,U=pU,V=pV).turnright()
return v
}
function nnediresize_YV12(clip c)
{
return nnediresize2x(c,true,true,true)
}
I thought about CYMK because in gimp I've been playing around with converting pics to CYMK so I can sharpen the K channel and blur the rest; results tend look good after playing around with levels in the K channel, and levels after the conversion back. Normally I use LAB, but lately I've been trying CYMK for kicks.
Blue_MiSfit
16th October 2008, 01:46
Very impressive results!
EDI resizing in GIMP would be nice :)
~MiSfit
Sagekilla
16th October 2008, 06:11
You know, thinking about this, I -completely- forgot what wonders NNEDI does for upscaling animated based video. I futzed around with an amalgam of various filters before to create a cleanup script for said animated video, especially poorly captured sources. I remember I was always annoyed at how blurry the lines look.
Thanks for reminding me Dark Shikari, now I have reason to go back and improve it again ;)
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.