View Full Version : Overlaying an image w/ gradient transparency
Raga
30th April 2006, 10:29
Mainly for purposes of correcting lighting, I'd want to be able to overlay an image, such as a 24-bit PNG with transparency, over the video.
Best explained with an image:
http://www.lakeofflowers.com/temp/transparent_mask.html
(You won't see that transparency in your Internet Explorer.)
I've been playing around with levels and overlays, but they don't seem to behave very gracefully with gradients at all, and even the VDub logo-filter only takes BMP input.
--
Ideally, of course, there would just be a filter like Photoshop's Render > Lighting Effects... But I suspect something like what's above is much more easy to create.
IanB
30th April 2006, 14:01
This is one of those cases (gradients) where having only 8 bit data lets you down horribly. I take it you are using overlay to "darken" the edges then levels to get the range correct again. During the process you effectively loose 1 bit of resolution in the intermediate result. Under worst case conditions the quantization becomes visible.
Perhaps MaskTools can offer some help. Some internal results are 9 bits so if you can somehow structure your process into 1 step it should work very much better.
Also a trick that may help, try using pre and post gamma adjustment to trade quantisation steps between dark and light areas. And use PC levels to maximise your scope, i.e 16->235 vrs 0->255. The Levels filter can do both in 1 step, note the need for the Coring=False option...
Levels(16, 1.1, 235, 0, 255, Coring=False)
Overlay(..., pc_range=true)
Levels(0, 1.0/1.1, 255, 16, 236, Coring=False)
...
Mug Funky
30th April 2006, 17:22
strangely enough i'm not seeing any banding on those pics (is my screen that blurred??).
if you are getting banding, you could add a little noise to your gradient image - just a tiny bit. this can be done within avisynth with the "addgrain" filter (you'll need to download it from warpenterprises' site).
however, with that colour cast things could get tricky. it's possible you'll want to white-balance the picture, do the overlay, then "un-white balance" it, so you don't get the grey falloff on the gradient. doing this in avisynth is quite tricky, but i'm sure it can be done in a minimum of operations (as ianb says, errors accumulate every time you do something).
dang... i can't wait for avisynth 3.0 and it's 15 bit colourspaces...
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.