PDA

View Full Version : Script to blur only green color in a frame


itcth
24th April 2004, 20:48
I intend to blur only green spot in a frame not the whole frame.If anyone can script please help.

Regards,

Mug Funky
26th April 2004, 19:45
umask = utoy().levels(64,.25,127,255,0,coring=false)
\.bicubicresize(last.width,last.height,0,.5)
vmask = vtoy().levels(64,.25,127,255,0,coring=false)
\.bicubicresize(last.width,last.height,0,.5)
greenmask=overlay(umask,vmask,mode="multiply")
overlay(last,last.SomeBlurFilter(radius),mask=greenmask)


you'll have to tweak this to hell, but there's enough there to work with. just play with the params in levels and you'll be fine.

remember to put a real blur filter in place of "someblurfilter"...

i can post one if you like, but it requires the latest masktools (can be found here.)

[edit]
damn that mf.... haven't tested this one...

[edit edit]
tested it and changed it appropriately.

mf
26th April 2004, 19:53
Bad Funky! In order for something to be green, it has to be 0 on U and on V. Otherwise you'll catch yellow as well.

Mug Funky
26th April 2004, 19:56
ah, poop. sorry :)

itcth
29th April 2004, 20:46
@Mug Funky/mf

Thanks for your help.I will try it.
Infact,i want to blur those tree behind my focus zone.I always encode with bad quality vcd whenever there are green leaves in my picture.

trevlac
29th April 2004, 22:01
@itcth

I made a modified version of Tweak that allows you to go after specific hue and satuartions.

http://trevlac.us/colorCorrection/TweakColor.zip

I'm not sure about the blur, but if reducing the saturation does not help, perhaps you can use it to target specific greens and make a mask.

Here's the simple usage to grab 115% to 50% green and desaturate it by 50%. A vectorscope is a good way to determine the hues. Switch the start and end to get everything but green.


LoadPlugin("TweakColor.dll")
colorbars(480,480).converttoYUY2()
TweakColor(sat=.5,startHue=200,endHue=260,maxSat=115,minSat=50)

itcth
29th April 2004, 22:18
@Mug Funky...

code:--------------------------------------------------------------------------------
umask = utoy().levels(64,.25,127,255,0,coring=false)
\.bicubicresize(last.width,last.height,0,.5)
vmask = vtoy().levels(64,.25,127,255,0,coring=false)
\.bicubicresize(last.width,last.height,0,.5)
greenmask=overlay(umask,vmask,mode="multiply")
overlay(last,last.Blur(1.0),mask=greenmask)
--------------------------------------------------------------------------------

I try the above script.It seems not to blur enough.Can you please post another script with latest masktools.


Thanks.

itcth
29th April 2004, 22:33
@trevlac...
Thanks for your script.I will try it now.TweakColor.avs look great.

Mug Funky
2nd May 2004, 13:50
itch: try my gauss function. it's around here somewhere. goes any radius you want.