Log in

View Full Version : Confused: MergeChroma giving color on black


mf
26th May 2003, 15:30
BlankClip().ConvertToYUY2()
MergeChroma(BlankClip(color=$7CDC77).ConvertToYUY2())
Will not produce complete black, but #002800 (very dark green). Is there something about the concept of YUV that I don't get, or is there something wrong with MergeChroma?

Wilbert
26th May 2003, 17:40
Why should it give a black clip?

clip=BlankClip.ConvertToYUY2
clip2=BlankClip(color=$7CDC77).ConvertToYUY2
MergeChroma(clip, clip2, 0)
colorYUV(analyze=true)

results in Y=16, U=V=128 (= black). As it should, because clip1 is black.

clip=BlankClip.ConvertToYUY2
clip2=BlankClip(color=$7CDC77).ConvertToYUY2
MergeChroma(clip, clip2, 1)
colorYUV(analyze=true)

results in Y=16, U=98, V=93 (not black). I don't know what the default value is for weight, but for sure it isn't zero. From http://www.fourcc.org/fccyvrgb.htm:

YUV to RGB Conversion:
B = 1.164(Y - 16) + 2.018(U - 128)
G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128)
R = 1.164(Y - 16) + 1.596(V - 128)

thus (using weight = 1):

B = -60.540 = 0
G = 40.185
R = -55.860 = 0

which is not black.

sh0dan
26th May 2003, 19:02
Wilbert is right - the picture will only be black, if luma <= 16 AND chroma = 128. This is how YUV works. Try ColorYUV(showyuv=true). Frame 0 will show the values, when luma = 16. As you see it is only black in the middle. Similar for white.

mf
27th May 2003, 12:42
So there's no way to color a clip without coloring black?