Log in

View Full Version : Removing high contrast ghosting


JClement
12th August 2023, 16:18
I have an old video that was captures off the air on VHS which has high contrast ghosting. The ghosting appears above and to the left of white imaages against a blue background. I have tried using the exhorcist filter in VirtualDub and can make the horizontal ghosting somewhat less obtrusive, but it won't work verically. There is a de-sharpeing filter by Flaxen but it causes huge problems in VirtualDub2, and it doesn't seem to work very well. So is there anyway to fix this in Avisynth?

I have uploaded two images to show the problem. The source image is before, and the output is after my attempts to fix it. The output also has other processing using Neat and deband as well as upscaling. The source was deinterlaced by QTGMC.

Sometimes the ghosting is quite obtrusive in the original, and sometimes softer. There is also some color bleeding to the R of the very bright image, but that is much less obtrusive.

StainlessS
12th August 2023, 16:46
Attachments can take forever.
Postimage instructions:- https://forum.doom9.org/showthread.php?p=1959414&highlight=postimage#post1959414

However, pictures are not much use and UNTOUCHED SOURCE video sample nearly always preferable.

EDIT: "but it won't work verically".
In avisynth, to apply horizontal filter to vertical, can use eg TurnRight() [then turnleft afterwards]. [EDIT: Or, turnleft(), then turnright()]
Vdub has Rotate() filter, maybe of use in your case, or maybe not.

johnmeyer
12th August 2023, 23:16
Here is a modified version of the stock MDegrain script which I modified to work with interlaced footage and which has an optional line which will shift chroma halos left or right, or up or down. Set VShift and/or HShift, then remove the comment from one (not both) of the "fields=MergeChroma ... " lines (depending on which way you need to move the halos to make them disappear).

It might work, but as StainlessS says, no one can do anything to help without a non-reencoded sample.

function MDegrain2i2(clip source, int "blocksize", int "over", int "denoising_strength", int "dct")
{
Vshift=0 # 2 lines per bobbed-field per tape generation (PAL); original=2; copy=4 etc
Hshift=0 # determine experimentally
overlap=default(over,0) # overlap value (0 to 4 for blksize=8)
dct=default(dct,0) # use dct=1 for clip with light flicker

fields=source.SeparateFields() # separate by fields

#This line gets rid of vertical chroma halo - use for VHS 2nd generation
#fields=MergeChroma(fields,crop(fields,Hshift,Vshift,0,0).addborders(0,0,Hshift,Vshift))

#This line will shift chroma down and to the right instead of up and to the left
#fields=MergeChroma(fields,Crop(AddBorders(fields,Hshift,Vshift,0,0),0,0,-Hshift,-Vshift))

prefiltered = RemoveGrain(fields,2)
superfilt = MSuper(prefiltered, hpad=32, vpad=32,pel=2)
super= MSuper(fields, hpad=32, vpad=32,pel=2)

halfblksize= (blocksize>4) ? blocksize/2 : 4
halfoverlap= (over>2) ? over/2 : 2

bvec1 = MAnalyse(superfilt, isb = true, delta = 2, blksize=blocksize, overlap=over,dct=dct)
bvec1 = MRecalculate(super, bvec1, blksize=halfblksize, overlap=halfoverlap,thSAD=100)

fvec1 = MAnalyse(superfilt, isb = false, delta = 2, blksize=blocksize, overlap=over,dct=dct)
fvec1 = MRecalculate(super, fvec1, blksize=halfblksize, overlap=halfoverlap,thSAD=100)

bvec2 = MAnalyse(superfilt, isb = true, delta = 4, blksize=blocksize, overlap=over,dct=dct)
bvec2 = MRecalculate(super, bvec2, blksize=halfblksize, overlap=halfoverlap,thSAD=100)

fvec2 = MAnalyse(superfilt, isb = false, delta = 4, blksize=blocksize, overlap=over,dct=dct)
fvec2 = MRecalculate(super, fvec2, blksize=halfblksize, overlap=halfoverlap,thSAD=100)

denoised = fields.MDegrain2(super, bvec1,fvec1,bvec2,fvec2,thSAD=denoising_strength)

even=selecteven(denoised)
odd= selectodd (denoised)
denoised = interleave( unsharpmask(even,30,3,4), unsharpmask(odd,30,3,4) )
Weave(denoised)
}