Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se |
|
|
#1 | Link |
|
Registered User
Join Date: Mar 2005
Posts: 366
|
Bloom filter for film look
I think this could be very useful for making filmlooks:
Bloomfilter/Filtermeister Couldn't this turn into a nice avisynth filter too? Personally I haven't the C skills needed - but I guess the math part might be a leap ahead? The FilmMeister manuals looks quite interesting too. Tin2tin
__________________
DVD slideshow GUI(Freeware). |
|
|
|
|
|
#3 | Link |
|
ReMember
Join Date: Nov 2003
Posts: 416
|
![]() Code:
AVISource("hi.avi")
o=last
AVISource("hi.avi")
Blur(1.58).Blur(1.58).Blur(1.58).Blur(1.58).Blur(1.58).Blur(1.58).Blur(1.58)
Levels(15, .8, 80, 0, 255, coring=false)
e=last
Overlay(o,e,mode="add",opacity=.25)
|
|
|
|
|
|
#4 | Link |
|
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,407
|
It might not matter too much in this case, because of the rather low opacity setting in Overlay ... however:
Never, never ever make a strong blur by chaining blur() several times. Not only it is slow, but more seriously blur() is not precise enough. Especially chroma will get *very noticeable* distortions. Use VariableBlur() instead, or simulate it through down&up-bicubicresize (not quite as accurate, but fairly fast): Code:
function FastGauss(clip clp, float rx, float ry)
{ ox=clp.width()
oy=clp.height()
clp.bicubicresize(m4(ox/rx),m4(oy/ry)).bicubicresize(ox,oy,1,0)
}
function m4(float x) {x<16?16:int(round(x/4.0)*4)}
__________________
- We´re at the beginning of the end of mankind´s childhood - My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!) |
|
|
|
|
|
#5 | Link |
|
ReMember
Join Date: Nov 2003
Posts: 416
|
![]() I know I used FastGaussBlur, but I wasn't sure what parameters to use on FastGauss. With FastGaussBlur there is more of a Bloom effect of glowing edges and Blurx7 seems to hold more detail but not really shine much. I was thinking of using FastGaussBlur but then forgot to look for it and just went with Blur quickly. So yes, FastGaussBlur would be better to use. Code:
AVISource("yea.avi")
o=last
AVISource("yea.avi")
FastGaussBlur(24)
Levels(15, .8, 80, 0, 255, coring=false)
e=last
Overlay(o,e,mode="add",opacity=.25)
function FastGaussBlur(clip clp, float rx, float "ry")
{
ry = default(ry, rx)
rx = rx+1.0
ry = ry+1.0
ox = clp.width
oy = clp.height
oxs1 = int(round(ox/4.0/sqrt(rx))*4)
oys1 = int(round(oy/4.0/sqrt(ry))*4)
oxs2 = int(round(sqrt(ox*oxs1)/4.0)*4)
oys2 = int(round(sqrt(oy*oys1)/4.0)*4)
oxs1 = oxs1<16 ? 16 : oxs1
oys1 = oys1<16 ? 16 : oys1
clp.bicubicresize(oxs1,oys1)
rx>9.0||ry>9.0 ? bicubicresize(oxs2,oys2,0.5,0.25) : last
return bicubicresize(ox,oy,1,0)
}
|
|
|
|
|
|
#6 | Link | ||
|
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,407
|
I knew I had once posted FastGaussBlur, but couldn't find it ATM
![]() Quote:
) However, using chaines of Blur() will "run dead" at some point, where it should do more blurring work, mathematically - but practically can't, because of the small radius and digital rounding (average of 1-2-2 is just 2, etc.)Quote:
FastGauss uses radius as parameter, FastGaussBlur uses variance, as does tsp's VariableBlur. Variance = radius^2 resp. radius = sqrt(variance). Personally, I like much more to think in "radius" than "variance", because radius is the usual way how Gaussian blurring is handled in image editors. Last note for this long useless post: There's something interesting about the "precision" of Avisynth's Blur() filter. Compare an 8fold chain of "Blur(1.0)" with the same 8fold chain of "Blur(1.58)". The former, being a true radius=1 Gaussian Blur, will produce a very noticeable color shift. The latter, being a plain 3*3 average blur, treats chroma correctly. Then compare both with FastGauss(8,8), FastGaussBlur(64,64), and GaussianBlur(64,64, Y=3,U=3,V=3,border=2), and see all the differences. Aditionally, check the histograms of all the outputs, it's interesting: Code:
o = last blur8gss = o.blur(1.0).blur(1.0).blur(1.0).blur(1.0).blur(1.0).blur(1.0).blur(1.0).blur(1.0) blur8avg = o.blur(1.58).blur(1.58).blur(1.58).blur(1.58).blur(1.58).blur(1.58).blur(1.58).blur(1.58) fastg8 = o.FastGauss(8,8) fastgb8 = o.FastGaussBlur(64,64) gb8exct = o.GaussianBlur(64,64,Y=3,U=3,V=3, border=3) # VariableBlur.dll interleave(o,blur8gss,blur8avg,fastg8,fastgb8,gb8exct) .histogram(mode="levels")
__________________
- We´re at the beginning of the end of mankind´s childhood - My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!) |
||
|
|
|
|
|
#7 | Link |
|
Movie buff & shine
Join Date: Jan 2004
Location: Logan, the only hole above ground.
Posts: 257
|
I know its been a while since this thread has been visited, but I was recently creating a similar filter for this effect, based on similar settings found in the AfterEffects filter.
This what I came up with: Code:
Function Glow (clip Last, int "radius", int "min", int "max", int "opacity") {
radius = Default (radius, 5)
min = Default (min, 234)
max = Default (max, min + 1)
opacity = Default (opacity, 1.0)
Mask = Levels (min, 1, max, 0, 255, false).ConvertToYUY2 ().\
SpatialSoften (radius, 255, 255).Levels (0, 1, 127, 0, 255, False)
White = Blankclip (Mask).Invert ("Y")
Overlay (Last, White, mask = mask, opacity = opacity)
}
__________________
I'm a boxer who can Bob () & Weave (). I like to Overlay () punches and Blur () his vision to ShowFiveVersions (). My KO punch will always Pulldown ().TimeStretch () and all he will hear is Tone (). |
|
|
|
|
|
#9 | Link |
|
Movie buff & shine
Join Date: Jan 2004
Location: Logan, the only hole above ground.
Posts: 257
|
I've uploaded two samples to my website here...
http://actionman133.isa-geek.net:808...w/preview.html
__________________
I'm a boxer who can Bob () & Weave (). I like to Overlay () punches and Blur () his vision to ShowFiveVersions (). My KO punch will always Pulldown ().TimeStretch () and all he will hear is Tone (). |
|
|
|
|
|
#10 | Link | |
|
Registered User
Join Date: Apr 2006
Posts: 10
|
Quote:
Code:
function FastGaussBlur(clip clp, float rx, float "ry")
{
ry = default(ry, rx)
rx = rx+1.0
ry = ry+1.0
ox = clp.width
oy = clp.height
oxs1 = int(round(ox/4.0/sqrt(rx))*4)
oys1 = int(round(oy/4.0/sqrt(ry))*4)
oxs2 = int(round(sqrt(ox*oxs1)/4.0)*4)
oys2 = int(round(sqrt(oy*oys1)/4.0)*4)
oxs1 = oxs1<16 ? 16 : oxs1
oys1 = oys1<16 ? 16 : oys1
clp.bicubicresize(oxs1,oys1)
rx>9.0||ry>9.0 ? bicubicresize(oxs2,oys2,0.5,0.25) : last
return bicubicresize(ox,oy,1,0)
}
|
|
|
|
|
|
|
#11 | Link | |
|
ReMember
Join Date: Nov 2003
Posts: 416
|
Quote:
|
|
|
|
|
|
|
#12 | Link | |
|
Movie buff & shine
Join Date: Jan 2004
Location: Logan, the only hole above ground.
Posts: 257
|
Quote:
Only bug so far.... still takes 5 seconds to filter a single frame! If anyone knows any efficient way to apply a radial blur, please let me know...Code:
Function Glow (clip Last, int "radius", int "min", int "max", int "opacity") {
radius = Default (radius, 5)
edges = (radius % 4) == 0 ? radius : radius + 4 - (radius % 4)
min = Default (min, 254)
max = Default (max, min + 1)
opacity = Default (opacity, 1.0)
Mask = ConvertToYUY2 ().Levels (min, 1, max, 0, 255, false)
Mask = Mask.AddBorders (edges, edges, edges, edges).SpatialSoften (radius, 255, 255).Crop (edges, edges, edges * -1, edges * -1).Levels (0, 1, 127, 0, 255, False)
White = Blankclip (Mask).Invert ("Y")
Overlay (Last, White, mask = mask, opacity = opacity, output = "YV12")
}
__________________
I'm a boxer who can Bob () & Weave (). I like to Overlay () punches and Blur () his vision to ShowFiveVersions (). My KO punch will always Pulldown ().TimeStretch () and all he will hear is Tone (). |
|
|
|
|
|
|
#13 | Link |
|
interlace this!
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
|
spatialsoften only gives a box blur IIRC.
try variableblur, as mentioned earlier in the thread. there's also a pretty fast convo filter in masktools that can give you some interesting blur effects.
__________________
sucking the life out of your videos since 2004 |
|
|
|
|
|
#14 | Link |
|
Movie buff & shine
Join Date: Jan 2004
Location: Logan, the only hole above ground.
Posts: 257
|
I know spatialsoften () isn't perfect. It wasn't doing the edges and it was damn slow...
I've actually found that the cubic mode in the box blur filter in VDub is very good at making a glow mask as well and it is very fast. Can I somehow load that into AVISynth to use? LoadVirtualDubPlugin only seems to support external plugins... PS. Tried VariableBlur (0.3, I think it was) but it refused to load...
__________________
I'm a boxer who can Bob () & Weave (). I like to Overlay () punches and Blur () his vision to ShowFiveVersions (). My KO punch will always Pulldown ().TimeStretch () and all he will hear is Tone (). |
|
|
|
|
|
#15 | Link |
|
Movie buff & shine
Join Date: Jan 2004
Location: Logan, the only hole above ground.
Posts: 257
|
I think this might be the true bloom
I should first say that I should renounce the first function that I posted, as it was a glow filter, one that makes it look like objects were emitting more light, not reflecting light.
This one should be a more accurate bloom. It works similarly to ones previously posted, but changes a couple steps. Rather than simply blending a blurred version of the clip with itself with low opacity, it uses Overlay's "add" mode at full opacity, combined with a mask based on the brightness of the blurred clip. Using "add" guarantees the the clip will only brighten the darker parts of the image, and the mask prevents excessive blooming in dark areas of the image (which normally wouldn't bloom). NOTE: this has only been tested with YUV data, and it REQUIRES Donald Graft's plugin port of VirtualDub's BoxBlur. Download it at http://www.neuron2.net threshold: the strength of the bloom. Values from 0-255, default 255. Decreasing the threshold will enhance the bloom effect. Lower values can add a 'dreamy' effect to the clip, but going too low can produce muddy shadows. radius: increases the size of the bloom. Default is 1/120 of the clip's width. Code:
Function Bloom (clip Last, int "threshold", int "radius") {
LoadVirtualDubPlugin ("BoxBlur.vdf", "BoxBlur")
radius = Default (radius, Round (Width / 120.0))
threshold = Default (threshold, 255)
threshold = Round (Threshold * 219 / 255.0) + 16
bloom = ConvertToRGB32 ("pc.601").BoxBlur (radius, 3, 1000).ConvertToYV12 (matrix = "pc.601")
bloommask = bloom.Tweak (sat = 0, coring = false).Levels (16, 1, threshold, 0, 255, false)
Overlay (last, bloom, mode = "lighten", mask = bloommask)
}
__________________
I'm a boxer who can Bob () & Weave (). I like to Overlay () punches and Blur () his vision to ShowFiveVersions (). My KO punch will always Pulldown ().TimeStretch () and all he will hear is Tone (). Last edited by actionman133; 20th May 2006 at 04:17. |
|
|
|
|
|
#16 | Link |
|
Registered User
Join Date: Aug 2005
Location: Asylum
Posts: 46
|
@actionman133
thank you! this works very well for me! Norman Bates
__________________
AVStoMPEG Forum: http://forum.doom9.org/showthread.php?t=110596 Blog: http://avstompeg.spaces.live.com/ |
|
|
|
|
|
#17 | Link |
|
Registered User
Join Date: Feb 2002
Posts: 1,195
|
work like a charm
thank u.++
__________________
AutoDub v1.8 : Divx3/4/5 & Xvid Video codec and .OGG/.MP3/.AC3/.WMA audio codec. AutoRV10 v1.0 : Use RealVideo 10 Codec and support 2 Audio Streams and Subtitles. |
|
|
|
|
|
#18 | Link |
|
Registered User
Join Date: Mar 2012
Posts: 29
|
Color lighting
I'm still new to this, I use gaussresize for speed and mt_lutxy u and v to enhance color (experiemental) for 30p DVDNTSC video or HD downscale to 720X480p (simple resize s fastest to me)
code : Function CBloom (clip Last, int "radius", int "radiusc", int "min", int "max", int "sat") { radius = Default (radius, 5) edges = (radius % 4) == 0 ? radius : radius + 4 - (radius % 4) radiusc = Default(radiusc,Round (Width / 120.0)) min = Default (min, 254) max = Default (max, min + 1) sat = Default (sat, 128) Mask = ConvertToYV12().Levels (min, 1, max, 0, 255, false) Mask = MergeLuma(Mask.GaussResize(width/radiusc,height/radiusc,p=1) \ .BilinearResize(width,height).Levels (0, 1, 127, 0, 255, False), 0.5) \ .ColorYUV(cont_u = sat, cont_v = sat) White = BlankClip(Mask, color=$FFFFFF, pixel_type = "YV12") \ .MT_lutxy(Mask.AddBorders (edges, edges, edges, edges) \ .FastGaussBlur(24) \ .Crop (edges, edges, edges * -1, edges * -1) \ ,yexpr="256 256 x - 256 y - * 256 / -" \ ,uexpr=" y 128 < x y * 128 /" \ ,vexpr=" y 128 < x y * 128 /" ,Y=3,U=3,V=3) MT_Merge (Last, White, mask, chroma = "process") } CBloom (radiusc=12,min=100,max=200,sat=512) #720X480psimpleresize and 24p_30p footage on 2 core cpu (1.6 ghz), media player classic set to evr in options. feel free to edit, enjoy Last edited by MJLives12; 9th July 2013 at 21:20. Reason: corrections in color |
|
|
|
|
|
#20 | Link |
|
Registered User
Join Date: Mar 2012
Posts: 29
|
NeonBloom (experiemental)
![]() Here's a cleaner way for color (trying to get that neon light look) code : Function NeonBloom (clip c, int "radius", int "min", int "max", int "sat", int "blur") { c radius = Default (radius, 2) min = Default (min, 254) max = Default (max, min +1) sat = Default (sat, 255) blur = Default (blur, 96) Mask = YLevelsG (min, 1, max, 0, 255) #gradient Mask = Mask.ConvertToRGB32 ().RGBAdjust(sat,sat,sat).ConvertToYV12 () \ .AddBorders (radius, radius, radius, radius) \ .FastGaussBlur (blur) \ .Crop (radius, radius, radius * -1, radius * -1) White = MT_lutxy (Mask \ ,yexpr="256 0 x - 256 y - * 256 / -" \ ,uexpr="x 255 == x 255 y y * 255 x - / min ?" \ ,vexpr="x 255 == x 255 y y * 255 x - / min ?", U = 3, V = 3) MT_Merge (white, Mask, U = 3, V = 3) } NeonBloom (min = 200, sat = 20) Enjoy. |
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|