vcmod


Author V. C. Mohan
Date Oct 2015
All my plugins are available for free download from "here".

vcmod plugin for vapoursynth version r24, is free and the author does not give any guarentee for its operation. It may be downloaded and used at the users risk.

vcmod has functions named Median, Variance, Amplitude, GBlur, MBlur and Histogram. These are thread safe.These are ported with suitable modifications from the original avisynth plugins. AdaptiveMedian, DeNoise, SegmentedAmp, GBlur, HBlur and HistogramAdjust. More elaborate descriptions of these functions are at those links. All the functions in this plugin modify pixel values as per some criteria, and hence the name.


------------------------------------------------------------------------------------------------

Amplitude

Amplitude function segments image on watershed principle. Smoothing is done if opted, restricting to boundaries within each basin. Sharpening is by spiking watershed boundaries and so must use small values. As watershed is known to over segment an image, the inputclip shold be clean and smooth. For convenience useclip parameter if set to 1, uses a pre smmothed clip( may be blurred by GBlur) for segmentation, and uses that on main input.


the script call for amplitude is

vcmod.Amplitude( clip, [ int useclip = 0] [,clip sclip,] [int connect4 = 1,] sh=[int,int,int], sm= [int,int,int])

sh and sm are smooth and sharp factors. Both arrays should not be zeroes.sh and sm arrays must be specified and are not optional. sh can be -10 to 10, and sm can be 0 to 10. connect4 if set uses near 4 points otherwise near 8 points in watershed algorithm.


------------------------------------------------------------------------------------------------

Histogram

Histogram can equalize whole frame or with moving window (slow) or match entire clip with a given frame or match as per specs given. Equalization may be severe for certain inputs, so a parameter limit which limits %age of change is provided. limit value of 0 means no limit. Windowed equalization is extremely severe. type 1 is full window equalization,type 2 is for matching with given table of up to 20 pairs (of %age luma val and %age population), minimum 2 pairs. Type 3 is for matching with a frame. fm is frame number of match clip to be used. YUV and Gray formats only are accepted.


The call is:-

vcmod.Histogram(clip [,clip clipm][,int type=1][,table=[int,int,.....] ][ ,int mf = 0][ ,int window = 0][,int limit] )


------------------------------------------------------------------------------------------------

Median

Median Filter is for eliminating certain types of noise. It uses local statistics (minimum, maximum and median values) of a moving local grid, and changes grid size depending on local statistics.

As per theory
Quote "Ordinary median filters perform well as long as the spatial density of impulsive noise is small. Adaptive Median filter can handle impulsive noise having larger probablity. An additional benefit is this seeks to preserve detail while smoothing nonimpulse noise something that the traditional median filter does not do.

The algorithm used has three purposes.
1.To remove salt and pepper (impulse) noise.
2.To smooth other noise which may not be impulsive
3.To reduce distortion such as excessive thinning or thickening of object boundaries.
" unquote

The Script call is:-

vcmod.Median (clip[, int maxgrid = 5] [,int plane[1,0,0] ] );


maxgrid is size to which grid can grow for getting statistics. Odd number 3 to 9.
plane: planes to be processed. 1 process, 0 do not. All 3 values must not be simultaneously specified as zero.
------------------------------------------------------------------------------------------------

GBlur

A separable Gaussian kernel of odd number size 3 to 11 is designed for blurring. The ksize and standard deviation can be specified.


the script call is

vcmod.GBlur(clip [, int ksize = 5][,float sd = 1.5])


------------------------------------------------------------------------------------------------

MBlur

MBlur blurs using values in a circle, or rectangle or along a line (motion blur) around a central point.type 1 is linear.type 2 for rectangular and type 3 for circular. The x and y coordinates are with respect to center. For circular x is treated as radius.


The script call is:

vcmod.MBlur(clip [ , int type = 1][ ,int x = 5][ ,int y = 5 ])


------------------------------------------------------------------------------------------------

Variance

From a given representative window, the global variance is determined. In a moving grid the local variance is determined and the center of the grid point is modified in relation to these two variances. The algorithm ensures that local edges are not destroyed. Repeated use of this function cleans image and may be used for very noisy clips. In case of YUV formats it is optional whether U and V planes are also to be processed. For RGB all 3 planes are processed. The window is specified by left x coord lx, width wd, top y coord ty, height ht and fn the frame number in which this window is located. The window should be as large as possible but have near uniform luma for YUV or Gray formats or uniform color and intensity for RGB format


The call script is :-

vcmod.Variance(clip,int lx,int wd,int ty,int ht [,int fn = 0][,int uv = 0][,int xgrid = 5][,int ygrid = 5])


------------------------------------------------------------------------------------------------
Example code and results. Input on left, output on right.
# Histogram
core.vcmod.Histogram(ret)



# Variance
core.vcmod.Variance(ret,lx=50,wd=50,ty=150,ht=100)



# Median
core.vcmod.Median(ret, maxgrid = 5, plane=[1,0,0])



# Amplitude Extreme right difference of input and output heightened
#smoothened by GBlur
ret2 = core.vcmod.GBlur(ret,ksize=5,sd=2)
ret1 = core.vcmod.Amplitude(ret,sh=[2,0,0],sm=[10,0,0], useclip=1,sclip=ret2)
ret2 = core.std.MakeDiff(ret1,ret)
#Difference heightened by equalization
ret2 = core.vcmod.Histogram(ret2)
ret=core.std.StackHorizontal(clips=[ret,ret1,ret2])



To my index page down load plugin To vapoursynth