BlurMod() + ApplyonAngle()

This forum is for questions and discussion of all the aspects of handling your footage. If you have questions about capturing/ripping footage, AviSynth, or compression/encoding/converting, look here.

BlurMod() + ApplyonAngle()

Postby Phantasmagoriat » Tue Oct 05, 2010 2:58 am

BlurMod()
...because sometimes you just need a really strong blur...
I included a picture below to see how weak blur() is in comparison. Anyways, I ended up with two functions that you may find useful. They work in the same sort of way. BlurMod() shrinks, blurs, then resizes; resulting in a very strong blur. ApplyonAngle() rotates, filters, then rotates back; making any filter appear as if applied on an angle.

Image original
Image blur(1.58)
Image blurmod(25)
Image blurmod(50)
Image blurmod(90)
------------------------------------------------------



It can be applied vertically and/or horizontally:
Image original
Image blurmod(0, 50)
Image blurmod(0, 90)
Image blurmod(50, 0)
Image blurmod(90, 0)
------------------------------------------------------



And even on angles:
Image original
Image blurmod(0, 40, 30)
Image blurmod(0, 90, 45)
------------------------------------------------------


ApplyonAngle()
Then I decided to turn the same method for rotation above into a stand-alone function so it can be applied with any filter:
Image original
Image addgrain(800, 0, 0.9)
Image applyonangle("addgrain(800, 0, 0.9)", 120)
------------------------------------------------------



Blurmod(horizontal_blur, vertical_blur, angle) : [1] [2]
Spoiler :
Code: Select all
function blurmod(
      \    clip   c
      \,   float   "x"
      \,   float   "y"
      \,   float   "angle")
{

angle= default(angle,0)
w  = c.width()
h  = c.height()
x  = default( x, 50 )
y  = default( y, x  )
x2 = sqrt(sqrt(sqrt(x*100)*100)*100)
y2 = sqrt(sqrt(sqrt(y*100)*100)*100)
w2 = (round( w*((102-x2)/102.0))/4)*4
h2 = (round( h*((102-y2)/102.0))/4)*4
w2 = (w2 >= 8) ? w2 : 8
h2 = (h2 >= 8) ? h2 : 8
bx = (x  == 0) ? 0 : 1.58
by = (y  == 0) ? 0 : 1.58

c
bilinearresize(w2,h2)
blur(bx, by)
spline36resize(w, h)

(angle == 0) ? last : \
c.applyonangle("blurmod(" +string(x)+ "," +string(y)+ ")",angle)

gradfun2db()

}



ApplyonAngle("filtering_method", angle) : [3]
Spoiler :
Code: Select all
function ApplyonAngle(
      \    clip   c
      \,   string   "filter"
      \,   float   "angle")
{

filter   = default(filter, "blurmod(0,50)")
angle   = default( angle, 45 )
w    = c.width()
h    = c.height()
d   = (round(sqrt(w*w + h*h))/4)*4
lr   = (d-w)/2
tb   = (d-h)/2

c
StackHorizontal( c.FlipHorizontal(),last)
StackHorizontal( last,c.FlipHorizontal())
StackVertical(last.FlipVertical(),last)
StackVertical(last,last.FlipVertical())
crop(0,0,0,-h)
lrc = (last.width()-d)/2
tbc = (last.height()-d)/2
crop(lrc,tbc,-lrc,-tbc)
rotate(-angle)
eval("last." + filter)
rotate(angle)
crop(lr,tb,-lr,-tb)


}

[1] Requires gradfun2db()
[2] The "angle" parameter is optional, but requires ApplyonAngle()
[3] Requires rotate()

Installation: [the usual]
  • copy/paste the scripts into .txt files,
  • rename to something like "BlurMod.avsi" and "ApplyonAngle.avsi"
  • put them in your avisynth plugins folder
  • put any required .dll's in your avisynth plugins folder, usually:
    C:\Program Files\AviSynth 2.5\plugins or
    C:\Program Files (x86)\AviSynth 2.5\plugins

I know this can be achieved in a lot of editing programs, but at least the option is here; and it might be useful if/when someone makes an avisynth-based NLE. Anyways, this is the second time I've made something with avisynth. Maybe it's been done before? but either way I think moar people should do this. Enjoy? :awesome:
Last edited by Phantasmagoriat on Fri Oct 08, 2010 11:17 pm, edited 1 time in total.
Image
Org Profile | AMVGuide | Phan Picks! | THE424SHOW | YouTube | "Galactic Escape"

"Effort to Understand; Effort to be Understood; to See through Different Eyes."
User avatar
Phantasmagoriat
 
Joined: 06 Feb 2006
Status: ☁SteamPunked≈☂

Re: BlurMod() + ApplyonAngle()

Postby BasharOfTheAges » Tue Oct 05, 2010 6:48 am

It might just be the frame you chose, but that last segment really looks like a heavy downpour.
Another Anime Convention AMV Contest Coordinator 2008-2014 & Head of the AAC Fan-works Theater - follow us on Twitter: https://twitter.com/#!/AACFanTheater
:sorcerer: :sorcerer: |RD: "Oh, Action!" (side-by-side) | |
User avatar
BasharOfTheAges
Just zis guy, you know?
 
Joined: 14 Sep 2004
Location: Merrimack, NH
Status: Extreeeeeeeeeme

Re: BlurMod() + ApplyonAngle()

Postby Phantasmagoriat » Tue Oct 05, 2010 1:15 pm

BasharOfTheAges wrote:It might just be the frame you chose, but that last segment really looks like a heavy downpour.
That's the idea ;)
It doesn't look as realistic in motion since it's all superimposed, but you can add more depth using layers. [you might want to use an NLE for that]
Image
Org Profile | AMVGuide | Phan Picks! | THE424SHOW | YouTube | "Galactic Escape"

"Effort to Understand; Effort to be Understood; to See through Different Eyes."
User avatar
Phantasmagoriat
 
Joined: 06 Feb 2006
Status: ☁SteamPunked≈☂


Return to Footage Help

Who is online

Users browsing this forum: No registered users and 3 guests