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 10th December 2012, 09:51   #1  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
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.
Chikuzen is offline   Reply With Quote
Old 11th December 2012, 17:29   #2  |  Link
Are_
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)
Are_ is offline   Reply With Quote
Old 11th December 2012, 17:48   #3  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
Quote:
Originally Posted by Are_ View Post
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
__________________
my repositories
Chikuzen is offline   Reply With Quote
Old 12th December 2012, 14:17   #4  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
updated to 0.1.2
__________________
my repositories
Chikuzen is offline   Reply With Quote
Old 13th December 2012, 08:20   #5  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
updated to 0.1.2-2
__________________
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 20:35.


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