PDA

View Full Version : My try at eliminating rainbows


Leak
4th July 2004, 01:38
EDIT: While you can of course use the script posted here I'd suggest using my BlendBob plugin (http://forum.doom9.org/showthread.php?postid=528315) that does basically the same thing, but faster... :)

EDIT: Added a few more images, maybe then someone - anyone - will respond to this... does suddenly everybody only have sources without rainbowing anymore and I didn't get the memo? :confused: :D

(And as I said further down below, the effect is more noticeable once you look at the video...)


Okay, so there I was, toying around with my (relatively) simple fieldmatcher that works on bobbed sources using my Japanese disc of Armitage III (dubbed "Rainbow-o-Rama" by me) as a test subject, being annoyed at all the rainbows this disc contains as ever.

Then it struck me...

Using a smart bobber on the source (which was 24 FPS film material) yields frames where 2 (or sometimes 3, in the case of telecine) should be mostly identical, save for some blurriness introduced by the bobber. But since the rainbows on that disc were produced by somehow running an already telecined source through some process that introduced them, the rainbows are actually the biggest chroma difference between 2 upscaled fields of the same frame as they change in every field, while the other chroma stays mostly the same.

So what I did now was improve my field matcher to not only blend 2 bobbed frames together that started out as 2 fields of the same frame, but to also calculate the difference between those 2 new frames (which almost leaves just the rainbows in the chroma), build a mask out of that and then use it to try to reduce the rainbows in these areas.

Well, apart from my current approach of reducing the rainbows (blurring the chroma by replacing it with a down- and upscaled version) I have to say it does a very good job of masking the rainbows...

BobBlended source without derainbowing:

http://gast3.ssw.uni-linz.ac.at/~kp/AviSynth/Rainbows/Armitage3_999_Source.png (http://leak.no-ip.org/AviSynth/Rainbows/Armitage3_999_Source.png)

BobBlended source with derainbowing:

http://gast3.ssw.uni-linz.ac.at/~kp/AviSynth/Rainbows/Armitage3_999_Derainbowed.png (http://leak.no-ip.org/AviSynth/Rainbows/Armitage3_999_Derainbowed.png)

(Try flipping back and forth between tabs with those pictures; it's even more noticeable in motion, so you'll find an AVI below...)

Marked rainbows:

http://gast3.ssw.uni-linz.ac.at/~kp/AviSynth/Rainbows/Armitage3_999_Rainbows1.png (http://leak.no-ip.org/AviSynth/Rainbows/Armitage3_999_Rainbows1.png)

Just the rainbows:

http://gast3.ssw.uni-linz.ac.at/~kp/AviSynth/Rainbows/Armitage3_999_Rainbows2.png (http://leak.no-ip.org/AviSynth/Rainbows/Armitage3_999_Rainbows2.png)

Another example:

http://gast3.ssw.uni-linz.ac.at/~kp/AviSynth/Rainbows/Armitage3_37948_Source.png (http://leak.no-ip.org/AviSynth/Rainbows/Armitage3_37948_Source.png)

http://gast3.ssw.uni-linz.ac.at/~kp/AviSynth/Rainbows/Armitage3_37948_Derainbowed.png (http://leak.no-ip.org/AviSynth/Rainbows/Armitage3_37948_Derainbowed.png)

http://gast3.ssw.uni-linz.ac.at/~kp/AviSynth/Rainbows/Armitage3_37948_Rainbows1.png (http://leak.no-ip.org/AviSynth/Rainbows/Armitage3_37948_Rainbows1.png)

http://gast3.ssw.uni-linz.ac.at/~kp/AviSynth/Rainbows/Armitage3_37948_Rainbows2.png (http://leak.no-ip.org/AviSynth/Rainbows/Armitage3_37948_Rainbows2.png)

AviSynth script that I used:


MPEG2Source("Armitage3.d2v",cpu=6,iPP=true)
AudioDub(last,DirectShowSource("Armitage3-66ms.ac3",video=false,audio=true))
DelayAudio(-0.066)

KernelBob(1,8)

BlendBob(derainbow=false,showRainbows=0)
#BlendBob(derainbow=true,showRainbows=0)
#BlendBob(derainbow=true,showRainbows=1)
#BlendBob(derainbow=true,showRainbows=2)

#Decimate()


(yeah, you'll want a Decimate() at the end to throw out the dupes, but for taking screenshots I left it out...)

My BlendBob script (http://leak.no-ip.org/AviSynth/Rainbows/BlendBob.avsi) (Documentation inside, I guess)
The intro of Armitage III after derainbowing (http://leak.no-ip.org/AviSynth/Rainbows/Armitage3_Derainbowed.avi) (XviD with constant quant 4)
The intro of Armitage III without derainbowing (http://leak.no-ip.org/AviSynth/Rainbows/Armitage3_Source.avi) (XviD with constant quant 4)
More screenshots can be found in the parent dir... (http://leak.no-ip.org/AviSynth/Rainbows/)

Now all I need is probably some better way of coming up with chroma values for the areas where rainbows have been detected - if anybody has ideas on that I'd be grateful. Also, it (and KernelBob) doesn't work too well on the first and last few lines, but that's probably fixable by some padding beforehand and cropping afterwards...

Oh, and I guess since I've got all exams for this term behind me, I'll have to get my ass in gear and actually pour this script into C code...

np: Amorphous Androgynous - Elysian Feels (Abbey Road Version) (The Otherness)

DaisyF
30th July 2004, 12:43
I haven't tried to use your script on any of my sources yet but I will try to implement it.

Is this process fast or does it seriously drop the framerate ? I'm only now looking into derainbow for my tv-caps and haven't tried any yet.

I was really impressed when I played both .avi at the same time next to each other. I hope to be able to give you more in depth feedback soon. I first will figure out in what way (as you say) the method you use is a bit dirty.

df

Leak
30th July 2004, 12:59
Originally posted by DaisyF
I haven't tried to use your script on any of my sources yet but I will try to implement it.

Is this process fast or does it seriously drop the framerate ? I'm only now looking into derainbow for my tv-caps and haven't tried any yet.

I was really impressed when I played both .avi at the same time next to each other. I hope to be able to give you more in depth feedback soon. I first will figure out in what way (as you say) the method you use is a bit dirty.

Oh, ummm... I knew I'd forgotten something - like this thread for instance.

While you of course could try this script you might want to use my BlendBob AviSynth plugin (http://forum.doom9.org/showthread.php?threadid=80289) instead... :D

It should be faster than this script, and I'm still working at adding MMX and SSE code to the derainbowing part so it should get even faster...

np: Telefon Tel Aviv - At The Edge Of The World You Will Still Float (Map Of What Is Effortless)

DaisyF
31st July 2004, 23:09
I will look into it... and respond in this thread.

morsa
1st August 2004, 03:50
what-s the way to detect rainbows?
I like it to remove the blue-orange artifacts that appears after demosaicking a Bayer Pattern RAW image...

Leak
1st August 2004, 09:53
Originally posted by morsa
what-s the way to detect rainbows?
I like it to remove the blue-orange artifacts that appears after demosaicking a Bayer Pattern RAW image...

That won't work - the video needs to be interlaced 24 or 30 FPS material so there'll be different rainbows in the 2 fields that make up a frame (with the rainbows being the only substantial difference between the fields), so you need to use this on movies or telecined anime series or something similar.

np: T.Raumschmiere - Someday (Radio Blackout)

Kurosu
2nd August 2004, 21:13
Originally posted by morsa
what-s the way to detect rainbows?
I like it to remove the blue-orange artifacts that appears after demosaicking a Bayer Pattern RAW image...
It will all the less work since that demosaicking is at best edge-aware interpolation (maybe you already looked at Dave Coffin's dcraw and its "Variable Number of Gradient" resizing implementation): what you see is just aliasing due to resampling of the R/G/B channels. Moreover, in such Bayer grids, blue and red are the one most coarsely sampled (i.e. 1 sample out of 4, much like YV12 but in the far more correlated RGB colorspace).

AFAIS, This filter is mostly reducing noise by doing a spatial averaging (down/upsampling) so it would only increase the 'color bleeding' you see. Maybe some warpsharping on chroma may work.

Piper
3rd August 2004, 20:49
FYI: Those who are seeking rainbow removal strategies may want to have a look at Sh0dan's rainbow killer script in the 80's Anime LD capture... need some help cleaning it up! (http://forum.doom9.org/showthread.php?s=&threadid=62873&highlight=Rainbow+Killer) thread.

I've used his technique for removing rainbows for some time now and haven't had the need to look elsewhere since. It's worked beautifully with my analogue captures - perhaps someone else here could also benefit from it.

Leak
3rd August 2004, 23:13
Originally posted by Piper
FYI: Those who are seeking rainbow removal strategies may want to have a look at Sh0dan's rainbow killer script in the 80's Anime LD capture... need some help cleaning it up! (http://forum.doom9.org/showthread.php?s=&threadid=62873&highlight=Rainbow+Killer) thread.

I've used his technique for removing rainbows for some time now and haven't had the need to look elsewhere since. It's worked beautifully with my analogue captures - perhaps someone else here could also benefit from it.

Yeah, but that blurs the whole chroma and overlays it on the parts where the high chroma values are.

My plugin (as well as the script above) blurs the chroma in exactly those parts where the rainbows are, and nowhere else.

np: Superpitcher - Even Angels (Here Comes Love)