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. |
10th December 2012, 09:51 | #1 | Link |
typo lover
Join Date: May 2009
Posts: 595
|
Spatial convolution filter for VapourSynth
Since vapoursynth has no native GeneralConvolution, I wrote it.
- 3x3 or 5x5 spatial convolution. - Gray/YUV/RGB(all bit depth) are supported. convo2d-0.1.3.7z sourcecode: https://github.com/chikuzen/convo2d EDIT: 2012-12-13 0.1.3 fix bug in 5x5 matrix, also, a bit faster than 0.1.2.
__________________
my repositories Last edited by Chikuzen; 13th December 2012 at 18:29. |
11th December 2012, 17:29 | #2 | Link |
Registered User
Join Date: Jun 2012
Location: Ibiza, Spain
Posts: 321
|
Hi Chikuzen and thanks for the new toy, but it crashes after python reaches almost 2GB of memory utilization.
Tested with one of the examples you gave in the readme: Code:
#!/usr/bin/env python3 # coding: utf-8 #============================================================== import vapoursynth as vs import sys, math core = vs.Core() core.std.LoadPlugin(path=r'C:\vs_plugins\convo2d.dll') #============================================================== clip = core.std.BlankClip(width=1280, height=720, format=vs.YUV420P8, length=5000, fpsnum=24, fpsden=1, color=[0, 128, 128]) #============================================================== def binalyze(val, thresh): return 236 if val > thresh else 16 def get_lut(thresh): lut = [] for y in range(256): for x in range(256): lut.append(binalyze(math.sqrt(x * x + y * y), thresh)) return lut #============================================================== clip = core.resize.Point(clip, format=vs.GRAY8) horizontal = [1, 2, 1, 0, 0, 0, -1, -2, -1] vertical = [1, 0, -1, 2, 0, -2, 1, 0, -1] edge_h = core.convo2d.Convolution(clip, horizontal, divisor=8) edge_v = core.convo2d.Convolution(clip, vertical, divisor=8) clip = core.std.Lut2([edge_h, edge_v], get_lut(16), 0) res = core.resize.Point(clip, format=vs.YUV420P8) res.output(sys.stdout, y4m=True) |
11th December 2012, 17:48 | #3 | Link |
typo lover
Join Date: May 2009
Posts: 595
|
sorry, fixed and updated to 0.1.1
__________________
my repositories |
12th December 2012, 14:17 | #4 | Link |
typo lover
Join Date: May 2009
Posts: 595
|
updated to 0.1.2
__________________
my repositories |
13th December 2012, 08:20 | #5 | Link |
typo lover
Join Date: May 2009
Posts: 595
|
updated to 0.1.2-2
__________________
my repositories |
Thread Tools | Search this Thread |
Display Modes | |
|
|