Chikuzen
10th December 2012, 09:51
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 (http://www.mediafire.com/download.php?v7wkb6du181x8kg)
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.
Are_
11th December 2012, 17:29
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:
#!/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)
Chikuzen
11th December 2012, 17:48
Hi Chikuzen and thanks for the new toy, but it crashes after python reaches almost 2GB of memory utilization.
sorry, fixed and updated to 0.1.1
Chikuzen
12th December 2012, 14:17
updated to 0.1.2
Chikuzen
13th December 2012, 08:20
updated to 0.1.2-2
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.