zee944
26th May 2011, 20:01
I'd like to add a luma curve to a video (I mean not touching the colors just making the pixels darker or brighter).
I have this little sample script:
LoadPlugin("GiCoCu.dll")
ImageReader("td_samp.png")
AddLumaCurve("full_flat.amp") # Photoshop curve with full zeros
Function AddLumaCurve(clip src, string curve)
{#
src
ConvertToRGB32
MergeChroma(GiCoCU(curve,photoshop=true).ConvertToYUY2,last.ConvertToYUY2)
ConvertToYV12
Return(last)
}
This is how the sample picture looks like originally:
http://i179.photobucket.com/albums/w286/zee944/td_samp.png
The curve (here: full_flat.amp (http://www.mediafire.com/?ayqfic727ffy4dl)) I'm using here is full of zeros, meaning it should make all the 0..255 values to zeros. (Of course I will never be using a flat curve, it's just for testing.)
So theoretically the end result would be full black. It isn't:
http://i179.photobucket.com/albums/w286/zee944/td_samp_black.png
I have ran into this before and I know it's YUV colorspace behavior and it's because U and V chroma planes are left untouched, but I just can't find the solution to elude the problem. It must be some GreyScale(), ShowRed/Green/Blue and MergeChroma/Luma trick and not even an extremely complicated one, but I'm playing around for hours now and can't figure it out. Can someone help me out? :confused: Thanks in advance.
I have this little sample script:
LoadPlugin("GiCoCu.dll")
ImageReader("td_samp.png")
AddLumaCurve("full_flat.amp") # Photoshop curve with full zeros
Function AddLumaCurve(clip src, string curve)
{#
src
ConvertToRGB32
MergeChroma(GiCoCU(curve,photoshop=true).ConvertToYUY2,last.ConvertToYUY2)
ConvertToYV12
Return(last)
}
This is how the sample picture looks like originally:
http://i179.photobucket.com/albums/w286/zee944/td_samp.png
The curve (here: full_flat.amp (http://www.mediafire.com/?ayqfic727ffy4dl)) I'm using here is full of zeros, meaning it should make all the 0..255 values to zeros. (Of course I will never be using a flat curve, it's just for testing.)
So theoretically the end result would be full black. It isn't:
http://i179.photobucket.com/albums/w286/zee944/td_samp_black.png
I have ran into this before and I know it's YUV colorspace behavior and it's because U and V chroma planes are left untouched, but I just can't find the solution to elude the problem. It must be some GreyScale(), ShowRed/Green/Blue and MergeChroma/Luma trick and not even an extremely complicated one, but I'm playing around for hours now and can't figure it out. Can someone help me out? :confused: Thanks in advance.