Log in

View Full Version : How to blur Croma for Colorkeying?!


mukor
5th June 2003, 21:58
Hi

I want to use footage done by a DV camcorder for bluescreening or greenscreening.
Then i've read about the 4:2:0 pulldown at DV-footage at PALformat.
So always 2 Pixels got 1 Chroma info, right?!
Now when i try bluescreening on this footage i get some stairy corners around the object, because of this problem caused by the DV standard.

Is there a simple way by use of a Avisynthscript to blur JUST the Chroma Chanel of a Image verticaly by 2 or 4 pixels so that i maybe get a smoother edge with the footage?!

sh0dan
5th June 2003, 22:19
Welcome!

AviSynth works natively in either 4:2:2 (YUY2) and 4:2:0. However that doesn't mean you cannot get a higher sampled mask.

Since you are working with blue-screen you only need the "u" chroma value. Assuming you have YV12 input you can use:utoy()
bilinearresize(width(last)*2,height(last)*2)
In case of YUY2 input I'd recommend:bilinearresize(width(last)*2,height(last)*2)
converttoYV12(interlaced=false)
utoy()
To get a softly upsized mask in the same resolution as your footage. You can work on this mask using blur, sharpen or any other filter.

Edit:
To upscale the mask to fullrange, use something like:coloryuv(off_y=-(128-16))
coloryuv(gain_y=235,off_y=-16)
... afterwards.

To get what you actually ask for (but doesn't necessarily (sp?) give you what you want):

Mergechroma(blur(1.5))

I would however still recommend you to try finding an alternative to DV, and doing your work in uncompressed 4:4:4. Also compositing programs are usually very good at this (Combustion has a very good keyer - and Ultimatte for After Effects is also widely used). All of these solutions are of corse quite expensive.

mukor
5th June 2003, 22:39
Oh.... Hi @ all first :D
I totally forgot to greet all for my first posting... sorry ;)

Well thanks for you quick answer!
I think you're right if you say that simple bluring of the smaller chroma sample wont solve my problem.
So enlarging the Chroma image and then bluring should help a little... I'll test it.

Yea of course it would be much better to use a better Camera Standard for recording bluescreen than DV but unfortunately I'm just able to use a miniDV Camcorder. :(

Well maybe this will help to get the best bluescreenresults out of DV footage ;)

If anybody else has a better/other idea to solve this DV/bluescreen-problem please write!

sh0dan
5th June 2003, 22:48
Actually working with the mask as greyscale data usually helps - use various filters to clean up edges, and false detections. I updated the post above with something to begin with, to get you a full-contrast mask - it should get you starte. Please post your results - I'm quite interested! :cool:

mukor
5th June 2003, 23:08
Hmm... sorry but now I'm a little confused about using what funktion in what combination. :(
And did i say that i still use Avisynth 2.08?!

So for my example i've startet a test.avs like this:

----------------------------------------------------
LoadPlugin("c:\PROGRA~1\Avisynth2\plugins\TomsMoComp.dll")
AVISource("D:\Video 2.avi")
FixBrokenChromaUpsampling
TomsMoComp(1,5,1)


I use the Canopus DV codec. Therefor the FixBrokenChromaUpsampling.
Am i right that Deinterlacing should be done before some chromaediting?
If not done before, the chroma of 2 different fields would be mixed, right?!
But what has to come next?!

I think it is absolutely easy to get the right filters with the right syntax together for someone with some trainin in avisynth but unfortunately I'm a pretty NewB in scripting Avisynth.
:(

Could you please add some lines to my examplescript above so that i can see in which order the filters to use?!:rolleyes:

sh0dan
6th June 2003, 08:38
You have to use 2.5x for any of the scripts above to work.

mukor
6th June 2003, 16:05
Awright! Now i've AviSynth 2.52 and the right version of TomsMoComp.
Ok and now?!

Please give me a example script! :)