Log in

View Full Version : rainbow effect


COREiP
2nd September 2006, 21:38
I am trying to clean up a video with rainbow effects. This is my script so far:

loadplugin("dgdecode.dll")
loadplugin("mpasource.dll")
loadplugin("tomsmocomp.dll")

MPEG2Source("1.d2v")
TomsMoComp(-1,5,1)
Crop(8,6,-8,-6)
LanczosResize(576,432)

Here is the video

http://rapidshare.de/files/31726925/tt.avi.html

COREiP
2nd September 2006, 21:45
btw thats a short clip encoded with the scrip I have made so far. The raw source is from a DVD.

Mug Funky
3rd September 2006, 02:14
post some unprocessed stuff and we'll be able to help you more...

rainbows and dot crawls are usually unremovable once the video's been filtered (especially deinterlaced).

if your source is NTSC, you can probably give dedot() a go (default settings are fine, which is good because the docs are in japanese). if that doesn't work search the forum for "rainbow" and see what else comes up. usually dedot is enough if the source is still 29.97fps, and no IVTC-while-encoding has taken place (ie DGindex reports 0% film, or 100% video)

COREiP
3rd September 2006, 02:39
What plugin do I need for dedot?

hartford
3rd September 2006, 02:40
You can try these (don't have the time to try, sorry):


Rainbow Removers:

Plugins:

BiFrost

GuavaComb


Scripts:

# Anti-Rainbow:

avisource("your.avi")
fft3dfilter(sigma=3,sigma2=3,sigma3=12,sigma4=3,bt=3,plane=1)
fft3dfilter(sigma=3,sigma2=3,sigma3=12,sigma4=3,bt=3,plane=2)
==

# fft3dfilter over U and V planes very effective against VHS rainbows

FFT3DFilter(sigma=1,bt=3,bw=32,bh=32,ow=16,oh=16)

==

DeRainbow: http://forum.doom9.org/showthread.php?p=398106#post398106

DeRainbow2: http://forum.doom9.org/showthread.php?t=90980&page=2&highlight=lothar+derainbow

==

From unknown:

Convolution3D(1, 0, 255, 0, 20, 50, 0)
deen("a3d",1,0,10)
MergeChroma(MSmooth())

==

# Rainbow remover by foxyshadis

# requires MaskTools,

function SmartSSIQ(clip input, int "strength") {
strength = default(strength, 255) #processing strength, 0-255

# apply rainbow remover to the entire video
derainbow = input.SSIQ(11, 300, false)

# create an edge mask from the rainbow video
edgemask = input.msharpen().mt_edge(thY1=0, thY2=255, thC1=255, thC2=255, mode="sobel").mt_inflate().GreyScale().Levels(0, 5, 255, 0, 255, coring=false)

# now layer the mask onto the input
result = overlay(input, derainbow, mode="blend", mask=edgemask, opacity=strength/255.0).Limiter()

return result
}

==

# mfRainbow v0.31 by mf
# Derainbows in areas of high Y, U and V frequencies, which fluctuate heavily.
#
# I don't claim copyright but I ask you to treat my script
# fairly.
#
# Changelog: Tweakable scenechange detection for tough sources
#
# Requires MaskTools.dll , Warpsharp.dll


function mfRainbow(clip input, string "mode", int "strength", int "scd", bool "post") {

strength = Default(strength, 255) # processing strength, 0-255
scd = Default(scd, 10) # scenechange detection

input.UnsharpMask(200).UnsharpMask(200).EdgeMask(3, 255, 255, 255, "roberts", Y=3, V=1,\
U=1).Deflate().Levels(0, 1.0, 45, 0, 255).Blur(1.0).Deflate().Levels(0, 1.0, 75, 0, \
255).Deflate().Deflate().Deflate().Greyscale()
ymask = last

input.UToY()
u = last

u.Unsharpmask(500).Unsharpmask(500).EdgeMask(3, 255, 255, 255, "roberts", \
Y=3, V=1, U=1).Levels(0, 1.0, 100, 0, 255).Greyscale()
LanczosResize(input.width, input.height)
umask = last

input.VToY()
v = last
v.Unsharpmask(500).Unsharpmask(500).EdgeMask(3, 255, 255, 255, "roberts", \
Y=3, V=1, U=1).Levels(0, 1.0, 75, 50, 255).Greyscale()
LanczosResize(input.width, input.height)
vmask = last

Overlay(ymask, umask, mode="lighten")
yumask = last

Overlay(yumask, vmask, mode="hardlight")
yuvmask = last

u.TemporalSoften(4,4,0, 12, 2).TemporalSoften(4,10,0, 12, 2)
YV12Subtract(last, u)
PointResize(input.width, input.height)
Levels(100, 1, 155, 0, 255, false)
MotionMask(thY1=0, thY2=255, y=3,u=1,v=1)
Levels(0, 1, 25, 0, 255, false)
GreyScale()
uflucts = last

v.TemporalSoften(4,4,0, 12, 2).TemporalSoften(4,10,0, 12, 2)
YV12Subtract(last, v)
PointResize(input.width, input.height)
Levels(100, 1, 155, 0, 255, false)
MotionMask(thY1=0, thY2=255, y=3,u=1,v=1)
Levels(0, 1, 25, 0, 255, false)
GreyScale()
vflucts = last

Overlay(uflucts, vflucts, mode="lighten")
uvflucts = last

Overlay(yuvmask, uvflucts, mode="hardlight")
Inflate().Inflate().Levels(0, 1, 100, 0, 255, false)
Greyscale()
bigedgemask = last
LanczosResize(u.width, u.height)
edgemask = last

input.UToY().temporalsoften(50,255,1,scd,2)
derainbowu = last
input.VToY().temporalsoften(50,255,1,scd,2)
derainbowv = last

edgerainbowu = MaskedMerge(u, derainbowu, edgemask, Y=3, U=1, V=1)
edgerainbowv = MaskedMerge(v, derainbowv, edgemask, Y=3, U=1, V=1)

edgerainbow = YToUV(edgerainbowu, edgerainbowv, input.Greyscale())

input.MergeChroma(edgerainbow)

}

==

Try them; only way to determine what works for you.

COREiP
3rd September 2006, 03:01
fft3dfilter(sigma=3,sigma2=3,sigma3=12,sigma4=3,bt=3,plane=1)
fft3dfilter(sigma=3,sigma2=3,sigma3=12,sigma4=3,bt=3,plane=2)

worked wonders thank you.

Blue_MiSfit
13th March 2008, 21:13
The dual fft with mixed sigmas worked very well for me as well!

DarkT
13th March 2008, 21:33
If I remmebr correctly, TCOMB can also work on dotcrawl/rainbowing.

MFDerainbow is nice, very nice, but it gave me problems similiar to "color-ghosting" or whatever it's called, if I remember correctly - so I don't use it...

Also, for rainbows I like using DFMDERAINBOW, script:

# Last updated 1/28/05
#
# By Scintilla, with the third line of themask's definition
# borrowed from Shodan's derainbower
#
###################
#
# Syntax:
# DFMDeRainbow(clip org, int "maskthresh", bool "mask")
#
# Required plugins:
# MSharpen, MaskTools, FluxSmooth (1.1+ required), Deen
#
# Arguments:
# maskthresh (default=10) - This is MSharpen's threshold value.
# Lower values will increase the area in which the blurred chroma
# is allowed to come through, which catches more edges but may
# cause desaturation and/or chroma bleeding.
# Set this as high as you can while still catching all the edges
# that need to be derainbowed.
# mask (default=false) - When true, this displays the mask instead of
# the image. Use this to find the optimal value of maskthresh.
#
###################

function DFMDeRainbow(clip org, int "maskthresh", bool "mask")
{
Assert(org.IsYUV(),"DFMDeRainbow: YUV input only")

org_u=org.UtoY()
org_v=org.VtoY()

first_u=org_u.FluxSmoothT(17).Blur(1.5)
first_v=org_v.FluxSmoothT(17).Blur(1.5)

themask=subtract(org,YtoUV(first_u,first_v,org)).Levels(108,1,148,0,255)
\ .MSharpen(mask=true,threshold=default(maskthresh,10)).Invert()
\ .Blur(0.5).Levels(0,2,255,0,255).Blur(0.5)

fixed_u=org_u.FluxSmoothST(17,14).FluxSmoothT(17).Deen("a2d",4,14,14).Blur(1.0)
fixed_v=org_v.FluxSmoothST(17,14).FluxSmoothT(17).Deen("a2d",4,14,14).Blur(1.0)
fixed=YtoUV(fixed_u,fixed_v,org)

output=MaskedMerge(fixed,org,themask,y=2,u=3,v=3)

return (default(mask,false)?themask:output)
}

Chainmax
14th March 2008, 11:23
I'd ditch DeDot and BiFrost as I've seen both cause some artifacting a couple of times. TComb has suited me very well for dotcrawl and rainbow removal. For dotcrawl alone, DeGrainMedian works nicely (have to thank Mug Funky for making that suggestion http://smilies.vidahost.com/otn/wink/thumb.gif) and for rainbow alone, I heartily second FFT3DFilter's chroma-only mode.