Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
|
Thread Tools | Search this Thread | Display Modes |
16th November 2008, 19:53 | #1 | Link |
Registered User
Join Date: Apr 2007
Posts: 240
|
Tune colors and luma levels in one video to look similar to another video
I regularly do projects where I have multiple cuts on multiple prints of the same movie, and I marry them into one.
Sometimes it's quite hard to fit them together and make them look like they're from the same source. Setting the right luma levels and right colors are especially tricky. This is how I do it recently: At first, I try to adjust gamma or contrast to achieve similar luma levels to the reference footage. Code:
Levels(0, <gamma level>, 255, 0, 255, coring=false) Code:
ColorYUV(cont_y=50, cont_u=50, cont_v=50) I save it as an .amp file and I load it in VirtualDub with GiCoCu filter. Code:
ConvertToRGB32 MergeChroma(GiCoCU("arbitrary_levels_curve.amp",photoshop=true).ConvertToYUY2,last.ConvertToYUY2) Code:
RGBAdjust(1.232, 1.058, 0.977) Code:
Tweak(sat=0.8) Question to those who are experienced in this kind of thing: 1. The most time-consuming thing is to draw an arbitrary levels curve. Is there a way I could (half-)automate it? If you have a 'reference' frame and the same frame from another print, how would you do it yourself? 2. Can the optimal color balance be foolproofly calculated? A larger bare surface can ruin my simple calculation. ColourLike() is for the same goal, but I could never get it to work, and just by judging from the thread it isn't free of side effects. If I can't improve it, I hope at least this will give a few ideas to others. Thanks for any input. Last edited by zee944; 16th November 2008 at 20:25. |
19th November 2008, 11:48 | #2 | Link |
Resize Abuser
Join Date: Apr 2005
Location: Seattle, WA
Posts: 623
|
Interesting problem, would any of these histogram functions improve your workflow? http://avisynth.org/mediawiki/Histogram
Using levels/color2 mode with ColorYUV http://avisynth.org/mediawiki/ColorYUV Code:
a=ImageReader("TD_sample_original.jpg",0,0,pixel_type="RGB32").ConvertToYV12() b=ImageReader("TD_sample_new.jpg",0,0,pixel_type="RGB32").ConvertToYV12() c=b b ColorYUV(gain_y=32,cont_y=32,cont_u=64,off_u=-4,cont_v=96,off_v=4) Tweak(0,0.8) Histogram("levels") b=last a Histogram("levels") a=last c Histogram("levels") c=last StackVertical(a,b,c) Then use ColorBalance with colors2 Code:
a=ImageReader("TD_sample_original.jpg",0,0,pixel_type="RGB32").ConvertToYV12() b=ImageReader("TD_sample_new.jpg",0,0,pixel_type="RGB32").ConvertToYV12() c=b b ColorYUV(gain_y=32,cont_y=32,cont_u=64,off_u=-4,cont_v=96,off_v=4) ConvertToRGB24() [ColorBalance=1] ColorBalance(last, \ [<separator="Shadows">] \ [<"S: Cyan-Red", -30.0, 30.0, 9.4>],[<"S: Magenta-Green", -30.0, 30.0, -5.7>],[<"S: Yellow-Blue", -30.0, 30.0, -17.0>], \ [<separator="Midtones">] \ [<"M: Cyan-Red", -30.0, 30.0, -11.2>],[<"M: Magenta-Green", -30.0, 30.0, 1.3>],[<"M: Yellow-Blue", -30.0, 30.0, 2.4>], \ [<separator="Highlights">] \ [<"H: Cyan-Red", -30.0, 30.0, 13.2>],[<"H: Magenta-Green", -30.0, 30.0, 0.0>],[<"H: Yellow-Blue", -30.0, 30.0, 1.9>], \ Select([<"Preserve Luminosity", 0, 1, 0>], false, true), \ Select([<"Clone Gimp", 0, 1, 1>], false, true), \ Select([<"16 Bit Color", 0, 1, 0>], false, true)) \ [/ColorBalance] ConvertToYV12() Tweak(0,0.75) Histogram("color2") b=last a Histogram("color2") a=last c Histogram("color2") c=last StackVertical(a,b,c) I'm assuming that you have tried just about every filter here http://avisynth.org/mediawiki/Extern...els_and_Chroma Setting curves can give very good results, it just takes time as I'm sure you have found out.
__________________
Mine: KenBurnsEffect/ZoomBox CutFrames Helped: DissolveAGG ColorBalance LQ Animation Fixer |
20th November 2008, 02:09 | #3 | Link |
interlace this!
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
|
that's a pretty good result there actually.
i think the big problem is one of these looks to have come off a release print, and the other from an intermediate negative film. also the middle one is waaay too saturated. just for fun i'm plugging away at this in photoshop, but it's a tricky one, especially without my trackballs (photoshop sucks for matching colours) [edit] one hint is that you need to pull out at least 50% of the saturation (probably more), and add a bucketload of red in the gain. the blacks need a dash of blue, and the highlights need to be selected and brightened toward orange.
__________________
sucking the life out of your videos since 2004 Last edited by Mug Funky; 20th November 2008 at 02:17. |
20th November 2008, 11:10 | #4 | Link |
Registered User
Join Date: Dec 2002
Location: UK
Posts: 1,673
|
Is 8-bits a bottleneck for this kind of problem? Where one colour changes to another, some of the edges look a bit cartoon-like in the "adjusted" version.
If the geometry of the two images matched perfectly, you could calculate a pixel>pixel RGB mapping, and then use some kind of curve fitting to generate smooth R, G and B mapping functions. If the geometry only matches approximately, then maybe working from the (smoothed) histograms and trying to calculate the shifts needed to make the two is the way to do. Which isn't a very helpful thing to say, as it's exactly what you've asked - an automated method of doing what you're doing by hand. Cheers, David. |
22nd November 2008, 16:54 | #5 | Link | ||||
Registered User
Join Date: Apr 2007
Posts: 240
|
Quote:
Quote:
Quote:
Code:
RGBAdjust(1.367, 0.882, 0.600) Tweak(0.7) Quote:
One could probably benefit from the picture content being (approximatively) the same; but I'm dreaming now. |
||||
23rd November 2008, 18:13 | #6 | Link |
Registered User
Join Date: Sep 2006
Posts: 602
|
What you are trying to do is correct the white balance for indoor lighting. The correct way to do this is to add/subtract an offset on each of the chroma channels. This is how camcorders change the white balance in the first place. Don't work in RGB space. To determine the offset for each chroma channel, calculate the average value. Subtract this from each pixel. You can use just one frame as a reference or correct each frame independently.
i.e., new chroma = old chroma - average of all chroma values in reference frame ( + the zero offset, e.g., 128 for unsigned 8-bit representation) Our software uses this method. I'm sure AVISynth has all the necessary mathematical functions to do it, too. An example of before and after (look at the picture of the garage scene): http://www.enosoft.net/products/enod...dj%20Split.jpg The right hand side is the original with a green cast. The left hand side is corrected using the method above. HTH |
23rd November 2008, 19:08 | #7 | Link | ||
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
Quote:
|
||
Thread Tools | Search this Thread |
Display Modes | |
|
|