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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > VapourSynth

Reply
 
Thread Tools Search this Thread Display Modes
Old 2nd January 2013, 18:55   #1  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
GenericFilters [Now part of VS core]

GenericFilters-0.7.0.zip

https://github.com/chikuzen/GenericFilters

GenericFilters is a set of common image-processing filters.

I think that the necessity of using masktools2 of avisynth will decrease considerably if this plugin and std.functions are used together.

Quote:
Cross reference list of masktools2 and GenericFilters

mt_edge - generic.Convolution/generic.Sobel/generic.Prewitt/generic.TEdge
mt_invert - generic.Invert
mt_binarize - generic.Binarize
mt_expand - generic.Maximum
mt_inpand - generic.Minimum
mt_inflate - generic.Inflate
mt_deflate - generic.Deflate
mt_clamp - generic.Limiter
mt_convolution - generic.Convolution/generic.ConvolutionHV
mt_hysteresis - generic.Hysteresis
mt_lut - std.Lut/std.Expr
mt_lutxy -std.Lut2/std.Expr
mt_lutxyz - std.Expr
mt_merge - std.MaskedMerge
EDIT:
20130812 update to 0.7.0
__________________
my repositories

Last edited by Chikuzen; 21st August 2013 at 03:22.
Chikuzen is offline   Reply With Quote
Old 2nd January 2013, 20:26   #2  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
It is my duty to shamelessly bump this post since it renders masktools almost completely obsolete. We're now one big step closer to getting completely native vapoursynth scripts for useful things.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is online now   Reply With Quote
Old 2nd January 2013, 23:33   #3  |  Link
Daemon404
Registered User
 
Join Date: Mar 2005
Posts: 128
Quote:
Originally Posted by Myrsloik View Post
It is my duty to shamelessly bump this post since it renders masktools almost completely obsolete. We're now one big step closer to getting completely native vapoursynth scripts for useful things.
I dream of a native OS X / Linux QTGMC.
Daemon404 is offline   Reply With Quote
Old 3rd January 2013, 21:53   #4  |  Link
sl1pkn07
Pajas Mentales...
 
Join Date: Dec 2004
Location: Spanishtán
Posts: 496
https://github.com/chikuzen/GenericFilters/issues/1
sl1pkn07 is offline   Reply With Quote
Old 4th January 2013, 03:03   #5  |  Link
06_taro
soy sauce buyer
 
Join Date: Mar 2010
Location: United Kingdom
Posts: 164
Quote:
Originally Posted by HolyWu View Post
Another thing is, I use the following script to compare the output of mt_edge and generic.Convolution.
Code:
clip = something
c1 = core.avs.mt_edge(clip, '1 2 1 0 0 0 -1 -2 -1 1', 0, 255)
c2 = core.generic.Convolution(clip, [1, 2, 1, 0, 0, 0, -1, -2, -1], planes=0)
clip = core.std.Interleave([c1, c2])
clip = core.std.ShufflePlanes(clip, planes=0, format=vs.GRAY)
I originally think the result of the two will be identical, but it's not. However I am no expert at matrix convolution so I may misunderstand its functionality and use it the wrong way.
I believe you intended to compare between avs.mt_convolution(clip, '1 2 1', '1 0 -1') and generic.Convolution(clip, [1, 2, 1, 0, 0, 0, -1, -2, -1], planes=0), which looks quite identical to me....
06_taro is offline   Reply With Quote
Old 4th January 2013, 07:04   #6  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
hmm...

generic.Convolution always saturate the output on 8bit format.
mt_edge("1 2 1 0 0 0 -1 -2 -1 1", 0, 255) is same as mt_convolution("1 2 1", "1 0 -1", saturate=false)

currently, I'm working on imprementing Sobel and Prewitt proper function by the request from Myrsloik.
Since I'm not familiar with SIMD, I may require time for beginning it.
__________________
my repositories

Last edited by Chikuzen; 6th January 2013 at 13:12.
Chikuzen is offline   Reply With Quote
Old 4th January 2013, 18:29   #7  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
Updated to 0.2.0

* Add new function 'Sobel'.
* Add new function 'Prewitt'.
* Convolution/HV: add new option 'saturate'.
* Minimum/Maximum: add new option 'coordinates'
* various bug fix.
__________________
my repositories
Chikuzen is offline   Reply With Quote
Old 4th January 2013, 21:23   #8  |  Link
Revgen
Registered User
 
Join Date: Sep 2004
Location: Near LA, California, USA
Posts: 1,545
The coordinates option and saturate option fix the issues HolyWu described. Thank You.
__________________
Pirate: Now how would you like to die? Would you like to have your head chopped off or be burned at the stake?

Curly: Burned at the stake!

Moe: Why?

Curly: A hot steak is always better than a cold chop.
Revgen is offline   Reply With Quote
Old 5th January 2013, 11:46   #9  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
Quote:
Originally Posted by HolyWu View Post
But the output of generic.Sobel/generic.Prewitt is quite different from the equivalent mode of mt_edge.
from masktools2 docs
Quote:
"sobel" uses the kernel "0 -1 0 -1 0 1 0 1 0"
I've never heard calling this "Sobel" except masktools.

Quote:
"hprewitt" is equivalent to : mt_logic(mt_edge("1 2 1 0 0 0 -1 -2 -1 1"), mt_edge("1 0 -1 2 0 -2 1 0 -1 1"), mode = "max"),
hprewitt? I think this is Sobel
and, Prewitt that I wrote is 'Prewitt compass edge detection' which requires 8 kernels.
__________________
my repositories

Last edited by Chikuzen; 5th January 2013 at 11:50.
Chikuzen is offline   Reply With Quote
Old 5th January 2013, 12:20   #10  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by Chikuzen View Post
from masktools2 docs

I've never heard calling this "Sobel" except masktools.


hprewitt? I think this is Sobel
and, Prewitt that I wrote is 'Prewitt compass edge detection' which requires 8 kernels.
Now you made me go check the reference literature...

Sobel is indeed defined as 1 2 1, 0 0 0, - 1 -2 - 1 and then the horizontal and vertical filters are usually summed up as sqrt(sh^2+sv^2) or abs(sh) + abs(sv) for speed. There are also variants where the filter is rotated when looking for diagonal edges but I've never seen it used.

Now on to prewitt. Apparently the prewitt guy was busy and suggested several similar things. But the one you want is described here: http://en.wikipedia.org/wiki/Prewitt_operator
and should be just about identical to sobel except that it's 1 1 1.

I really can't find any mention of masktool's so called sobel filter. I can however tell you this, it really is implemented like a single 0 1 0, 1 0 -1, 0 -1 0 convolution and I think it looks like a horrible idea. It's easy to see that edges get a VEEEEEERY different weight depending on directionality. Just imagine a diagonal gradient in the \ and / directions and see the difference in result.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is online now   Reply With Quote
Old 5th January 2013, 12:52   #11  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
I found some typo and wrong understanding on Sobel and Prewitt.

updated to 0.2.1

* Sobel/Prewitt: fix invalid logic
* Sobel/Prewitt: Change default values of 'min' and 'max'
__________________
my repositories
Chikuzen is offline   Reply With Quote
Old 5th January 2013, 16:25   #12  |  Link
aegisofrime
Registered User
 
Join Date: Apr 2009
Posts: 478
So is there an updated version of QTGMC implementing these generic filters yet?
aegisofrime is offline   Reply With Quote
Old 5th January 2013, 17:07   #13  |  Link
Revgen
Registered User
 
Join Date: Sep 2004
Location: Near LA, California, USA
Posts: 1,545
^Not yet.

The current Vapoursynth QTGMC script is here. http://forum.doom9.org/showthread.php?t=166582
__________________
Pirate: Now how would you like to die? Would you like to have your head chopped off or be burned at the stake?

Curly: Burned at the stake!

Moe: Why?

Curly: A hot steak is always better than a cold chop.
Revgen is offline   Reply With Quote
Old 6th January 2013, 07:59   #14  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
updated to 0.2.2

* Sobel, Prewitt: add new option 'rshift'
* Sobel, Prewitt: fix 9/10/16bit format processing
__________________
my repositories
Chikuzen is offline   Reply With Quote
Old 6th January 2013, 15:28   #15  |  Link
Are_
Registered User
 
Join Date: Jun 2012
Location: Ibiza, Spain
Posts: 321
Link to 0.2.2 does not work.
Are_ is offline   Reply With Quote
Old 6th January 2013, 17:09   #16  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
Quote:
Originally Posted by Are_ View Post
Link to 0.2.2 does not work.
fixed
__________________
my repositories
Chikuzen is offline   Reply With Quote
Old 11th January 2013, 18:02   #17  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
updated to 0.3.0

* add new function 'Blur'
__________________
my repositories
Chikuzen is offline   Reply With Quote
Old 11th January 2013, 20:31   #18  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,843
kolak is offline   Reply With Quote
Old 16th January 2013, 17:04   #19  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,843
Looks like there is a bug in blur when format is 16bit- footage has some green artefacts (10bit and 8bit are ok).
kolak is offline   Reply With Quote
Old 16th January 2013, 22:20   #20  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
(Probably,) fixed.
genericfilters_0.4.1.dll
__________________
my repositories
Chikuzen is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:58.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.