logo Sign In

Post #592636

Author
Moth3r
Parent topic
Moth3r's guide to LD capture colour correction using AviSynth (emphasis on "correction")
Link to post in topic
https://originaltrilogy.com/post/id/592636/action/topic#592636
Date created
19-Sep-2012, 7:17 AM

Introduction

This guide is intended to help those of you who are capturing analogue sources (from laserdisc, in the main) to ensure that the colours in your digital capture match your analogue source as close as possible.

The method is strictly a numbers-based calibration of your capture chain, it is not intended to help you get "natural looking" skin tones or any other subjective outcome.


Step 1: Capture a test pattern off a laserdisc. 

Several LDs include these, for example:

   

---- SMPTE color bars ----   ---- BBC Test Card G ----

These patterns may be found on blank unused sides, or in special set up chapters. There are also discs that are dedicated to such set up patterns, such as A Video Standard or Video Essentials. There is a work-in-progress list of laserdiscs that contain test patterns here.

Play your laserdisc, and capture the test pattern. Some capture cards let you adjust capture settings such as brightness, contrast and saturation, other capture devices (such as Firewire units or DVD recorders) do not give you this option. If you do have these adjustments, you can set your card up to be approximately correct (but be careful not to clip anything), then fine tune the result using the AviSynth method below.


Step 2: Analyse your capture - "observed" colours

Rather than try and read individual pixel values, it's useful to crop out all other bars so you're left with a frame containing just one colour, then use ColorYUV(analyze=true) in AviSynth to find the average YUV values.

For example, using this image of the SMPTE color bars, as captured by Darth Mallwalker from his Technidisc LD pressing of Empire, we can crop and analyse the areas shown below:

By using the script below:

ImageReader("D:\Video projects\colour correction test\on0000.png")
ConvertToYUY2()
video_black=Crop(348, 366, -192, -10).PointResize(480, 120).ColorYUV(analyze=true)
video_white=Crop(118, 366, -422, -10).PointResize(480, 120).ColorYUV(analyze=true)
yellow=Crop(96, 78, -470, -164).PointResize(480, 120).ColorYUV(analyze=true)
grey=Crop(18, 12, -560, -164).PointResize(480, 120).ColorYUV(analyze=true)
red=Crop(462, 10, -100, -162).PointResize(480, 120).ColorYUV(analyze=true)
cyan=Crop(188, 76, -376, -164).PointResize(480, 120).ColorYUV(analyze=true)
StackVertical(video_black, video_white, yellow, grey, red, cyan)

The resizing is necessary in order to be able to read the statistics. The script outputs the following result (we are interested in the average values for each channel):

It shouldn't matter too much which six colours you choose, but I'd recommend you include black, white and at least one grey to help with the gamma setting.


Step 3: Determine what the colours should be - "target" colours

The colours in the test patterns have exact specifications. We know, or can work out, exactly what RGB (or YUV) values represent each solid colour block.

Here's the RGB values for the colours in the SMPTE colour bars we chose earlier: 


4. Find the parameters required to get a "best fit" to the correct colours

Download the Excel spreadsheet here, and complete the observed and target colour values.

The idea is to find parameters that result in adjusted colours having a "best fit" correlation with the target colours (i.e. error is minimised using the least squares method). Run the solver add-in from Excel, and it should be set up as follows:

Provided your colours are close enough in the first place, and you haven't made an error in entering any values, Solver should stop after a while with a solution. 


5. Add line in AviSynth script - to transform observed colours into target colours 

The next step is simple: just add the ColorYUV command from the spreadsheet into your AviSynth script:

Source(...)
ColorYUV(gain_y=5.60, off_y=6.47, gamma_y=-74.85, off_u=-1.08, cont_u=1.65, off_v=0.26, cont_v=9.78)


Examples


SMPTE color bars - raw source


SMPTE color bars - corrected


Technidisc LD - raw


Technidisc LD - corrected


Technidisc - raw


Technidisc - corrected


BBC Test Card G - raw source


BBC Test Card G - corrected


PAL THX LD - raw source


PAL THX LD - corrected