Log in

View Full Version : Filters to reduce severe color bleeding


ph4nt0m
21st December 2015, 23:22
Hi,

I'm currently dealing with a source that suffers from some heavy color bleeding (if that is the correct term):

http://s28.postimg.org/adhuahtg9/im1.png (http://postimg.org/image/adhuahtg9/) http://s28.postimg.org/4ba7k0509/im2.png (http://postimg.org/image/4ba7k0509/)

What I managed so far is to get rid of the overall red tint by playing aroung with Tweak (see right picture for result):

DGDecode_mpeg2source("sample.d2v", cpu=4)

Tweak(sat=0.7, hue=-15, startHue=75, endHue=137, coring=true)
Tweak(sat=1.35)

Of course this does not remove (or reduce) the bleeding at all: Blue areas seem to have a yellow halo to their right, whereas yellow areas produce a blue bleeding.

I uploaded a short sample that might be helpful to understand the problem: http://www40.zippyshare.com/v/tHYz9UfR/file.html

Is there anything that can be done to get rid of this issue without losing to much color information?

Thanks in advance!

Motenai Yoda
22nd December 2015, 05:56
seems to me like a colormatrix case...
for the bleeding try to use awarpsharp2(chroma=6) and maybe some mask to avoid overthinning on details.

ph4nt0m
22nd December 2015, 10:18
Thanks for your suggestion, but for me awarpsharp2(chroma=6) does literally nothing in this case.

I tried some different settings, but I'm not sure if this is the right approach at all. The bleeding in this clip seems to be too "wide" - it's affecting at least 10 px on the right of certain areas.

Mounir
22nd December 2015, 11:19
Try this to begin with

MPEG2Source("sample.d2v", cpu=0, info=3)
# move chroma UP
separatefields()
A=Last
B=A.Greyscale()
Overlay(B,A,X=0,Y=-1,Mode="Chroma")
weave()

#Remove chroma noise with removespotmc
separatefields()
input=last
U = UtoY().RemoveSpotsMC()
V = VtoY().RemoveSpotsMC()
YtoUV(U, V, last)
weave()

# Remove chroma noise with CCD
ConverttoRGB32(matrix="PC.601",interlaced=true)
separatefields()
LoadVirtualDubPlugin("C:\Program Files (x86)\VirtualDub\plugins\Camcorder_Color_Denoise_sse2.vdf","CCD",1)
# Desaturate
CCD(7,1) # 0 to 100 # Default =30
weave()
ConverttoYV12(matrix="PC.601",interlaced=true)

ph4nt0m
22nd December 2015, 11:58
I can't see any noticable difference when applying your script. From what I understand, it only removes some (chroma) noise but how would that help against the color bleeding issue?

If I'm misunderstanding something, please tell me. :)

raffriff42
22nd December 2015, 15:08
If there's nothing better, I might suggest FixChromaBleedingMod (http://avisynth.nl/index.php/FixChromaBleedingMod): it decreases peak saturation, which helps a bit, but it's not a cure.

Moving the chroma to the left also helps. I used my own chroma offset function for this, but try ChromaShiftSP (http://avisynth.nl/index.php/ChromaShiftSP) as well. You will want to refine the offset settings; there was no U channel (yellow-blue (http://avisynth.nl/index.php/Histogram#Levels_mode)) to work with in this shot.FixChromaBleedingMod(cxShift=0, cyShift=0, thr=16.0, strength=1.0) ## cxShift, cyShift have no effect?
UUChromaOffset(ux=0, uy=0, vx=-2, vy=-2) ## move V channel (red-green) up and to the left
return Last

##################################
function UUChromaOffset(clip C, int "ux", int "uy", int "vx", int "vy")
{
Assert(C.IsYUV, "UUChromaOffset: source must be YUV")
ux = Default(ux, 0) ## U channel, X direction
uy = Default(uy, 0) ## U channel, Y direction
vx = Default(vx, ux) ## V channel, X direction
vy = Default(vy, uy) ## V channel, Y direction
U = C.UToY8()
V = C.VToY8()
return YToUV(
\ U.Overlay(U, x=ux, y=uy),
\ V.Overlay(V, x=vx, y=vy),
\ C.ConvertToY8())
}

Reel.Deel
22nd December 2015, 15:53
The problem with FixChromaBleedingMod is that is meant to reduce chroma bleeding/over-saturation mainly in red and blue areas (v channel). Setting it to a high threshold helps a bit to reduce bleeding in yellow areas but can cause unwanted side effects in other areas. The script has potential but it needs to be modified to target bleeding other than red and blue.

LemMotlow
22nd December 2015, 18:26
The red tint is obvious, but it's red saturation along with other colors. Never had much luck with tweak.

I used this:
ColorYUV(cont_v=-130,off_v=-4)
ColorYUV(cont_u=-40)
SmoothTweak(saturation=1.4)
Then I raised mid levels a bit with ColorMill. The sample looks a little dim and grimy. Before's and after's:

http://forum.doom9.org/attachment.php?attachmentid=15191&stc=1&d=1450804931
http://forum.doom9.org/attachment.php?attachmentid=15192&stc=1&d=1450804978
http://forum.doom9.org/attachment.php?attachmentid=15193&stc=1&d=1450805025

There's still a problem with blue/green. Blue has a bad midrange spike, and in a blue histogram is shaped like a left-hand "wedge".
You can't just reduce blue saturation, everything turns green.
The green has too much blue because of it. White arrows point to the blue spike problem. Maybe masktools can fix that?

http://forum.doom9.org/attachment.php?attachmentid=15194&stc=1&d=1450805058

Mounir
22nd December 2015, 18:48
I can't see any noticable difference when applying your script.[....]

try this then:

MPEG2Source("sample.d2v", cpu=0, info=3)
# move chroma UP
separatefields()
A=Last
B=A.Greyscale()
Overlay(B,A,X=0,Y=-1,Mode="Chroma")
weave()

#Remove chroma noise with removespotmc+ fft3dfilter( tweak the sigma as you wish)
separatefields()
input=last
U = UtoY().RemoveSpotsMC().fft3dfilter(bt=4,sigma=12,plane=3,degrid=1)
V = VtoY().RemoveSpotsMC().fft3dfilter(bt=4,sigma=12,plane=3,degrid=1)
YtoUV(U, V, last)
weave()

# Remove chroma noise with CCD
ConverttoRGB32(matrix="PC.601",interlaced=true)
separatefields()
LoadVirtualDubPlugin("C:\Program Files (x86)\VirtualDub\plugins\Camcorder_Color_Denoise_sse2.vdf","CCD",1)
# Desaturate
CCD(7,1) # 0 to 100 # Default =30
weave()
ConverttoYV12(matrix="PC.601",interlaced=true)

#remove some chroma bleeding
separatefields()
chromavid = awarpsharp2(depth=16, chroma=3)
mergechroma(chromavid,1.0) # default= 0.5
weave()

LemMotlow
22nd December 2015, 18:57
That video sample is progressive, encoded as interlaced.

Oops, I somehow erased the following before posting:
I don't see very much usual color bleed. Problem looks like bad blue ghosting, smearing. Blue and green are
really messed up here. Ideas posted so far don't seem to address it. Tried heavy reduction of blue contrast
in AfterEffects/ColorFinesse but it just turned greens to gray. Some process sure borked YUV in this sample.

raffriff42
31st December 2015, 04:36
WarpSharp (http://avisynth.nl/index.php/WarpSharp/WarpSharp) on the chroma reduces chroma bleed somewhat.

https://www.dropbox.com/s/gqoih9l32mqfrjq/Color_sharpen_test-org-YV411.png?raw=1
DQ monitor test image (https://www.google.com/search?q=DQ+monitor+test+image&tbm=isch) detail, converted from RGB source to YV411.
(Note the color bleed.)

https://www.dropbox.com/s/yhdke110snk5iv2/Color_sharpen_test-WarpSharp.png?raw=1
(ChromaWarpSharpener)

## http://avisynth.nl/index.php/WarpSharp/WarpSharp
##
## returns YV12 or YV24
##
function ChromaWarpSharpener(clip src, int "strength", bool "YV24")
{
str = Default(strength, 64)
yv24 = Default(YV24, false)

U = src.UToY8
\ .ConvertToYV12
\ .WarpSharp(depth=str, blur=1, bump=Min(str, 128))
\ .ConvertToY8
V = src.VToY8
\ .ConvertToYV12
\ .WarpSharp(depth=str, blur=1, bump=Min(str, 128))
\ .ConvertToY8

U = (YV24) ? U.BicubicResize(src.Width, src.Height) : U
V = (YV24) ? V.BicubicResize(src.Width, src.Height) : V

return YToUV(U, V, src.ConvertToY8)
}

Reel.Deel
31st December 2015, 05:34
Interesting, I've never tried reducing chroma bleeding with WarpSharp. I'd be nice if it allowed guiding the chroma with the luma edge mask, just like in aWarpSharp2. Not too long I tried GIMP's WarpSharp (http://www.home.unix-ag.org/simon/gimp/warp-sharp.html) (updated script (https://web.archive.org/web/20150410073728/http://www.gimphelp.org/scripts/sharpness_warp-sharp.shtml)) with a few pictures and found the warping to be a bit more consistent than aWarpSharp2. Supposedly GIMP's WarpSharp is what VDubs/AviSynth's WarpSharp is based on.

geometer
31st December 2015, 14:34
Looks like a TV capture, or from a poor video recorder.
I'd suggest to use some anti-ghosting filter, or manually on a copy of the clip, a chroma shifter on the V value, some 5-8 px, then probably needs to blend that together with the original in the RGB domain. It will create a new ghost with half intensity, that goes another 5 px to the right, thus perhaps the formula should be repeated a couple of times, until the ghost fades out sufficiently.
Basic values to adjust: shifting distance, and blending intensity.
After the V is kind of ok, possibly a ghost in the U may become visible too, then add the same for the u chroma.

ph4nt0m
19th July 2016, 20:24
Well, I was finally able to circumvent this issue by getting a different copy of the same TV show. Although that one was quite blurred, colors were much better. Carefully aligning both streams w.r.t. time and space and then using MergeChroma() gave a nice result.