Log in

View Full Version : Match, color correct, output.


anton_foy
29th January 2022, 21:21
My goal is to Color Correct a batch of clips automatically and using reference images to further get the process more towards natural colors or even a certain Color Correction "style". So I came up with an idea:

1. make a library of images/data, the original image and manually Color Corrected image, extract the histogram data from both versions (original and color corrected).

2. analyze the imported new clips/images in Avisynth and compare their histogram data to the original ones in the library to match to the closest "looking" one(s).

3. Then change the colors and gamma to be closer to the Color Correction corresponding to the matched library image histogram.

4 (and/or). Apply automatic Color Correction filter(s) (GamMac/GamMatch/Autolevels/RGBAdapt/Automatic White Balance/GreyWorld etc.) and match histogram to the matched Color Corrected image in the library.

5. output the Color Correction to a file as data or .cube (it can be applied onto a hald.png and then convert into a .cube for example) to be used in other programs aswell.

So in short, match the clip/image to the most fitting in the library, auto color correct and output new correction as data.
I would like to find out if it is possible in AVS+ and if there are better ways to do this.
For example if it is a good approach to match using histogram to find out if the colors and gamma corresponds to the clip to be processed.

EDIT: maybe this idea with matching histograms is already what GamMatch is doing? I just found out about it when I searched around here.

StainlessS
29th January 2022, 22:22
GamMatch requires 2 clips, bad color clip, and good color, bad rez clip,
corrects bad color clip to be same as good color bad rez clip.

anton_foy
30th January 2022, 03:50
GamMatch requires 2 clips, bad color clip, and good color, bad rez clip,
corrects bad color clip to be same as good color bad rez clip.

Yes that is awesome but what if the clip is not identical? Yet it has similar values histogramically?

StainlessS
30th January 2022, 04:10
but what if the clip is not identical?
Then it dont work.

Look for plugin ColorLike(), but author was not that impressed with it.

Not sure, think Wonkey_Monkey did some demo on Youtube to correct a star wars sequence,
however was way way expensive on human time [not automatic].

poisondeathray
30th January 2022, 04:29
Maybe helpful for the matching part of your workflow, MatchHistogram is similar to Colourlike() , but slightly better IMO . Also native x64 plugin. Colourlike can work with mp_pipeline ok in avs x64

http://avisynth.nl/index.php/MatchHistogram

An accurate method is the gimp g'mic haldclut method "CLUT from After - Before Layer" ; but it requires very similar frame (even slight differences can cause errors) . Haldclut can be converted to .cube with a batch python script

I don't think any g'mic filters are implemented in avisynth

StainlessS
30th January 2022, 07:58
MatchHistogram is similar to Colourlike() , but slightly better IMO . Also native x64 plugin. Colourlike can work with mp_pipeline ok in avs x64

http://avisynth.nl/index.php/MatchHistogram

Please confirm, it is x64 ColorLike that can work in mp_Pipeline. [looks like a typo]

Reel.Deel
30th January 2022, 08:25
Please confirm, it is x64 ColorLike that can work in mp_Pipeline. [looks like a typo]

I think it means that ColourLike is only 32-bit, but works well with mp_pipeline and AviSynth+ x64.

Looks like ColourLike can probably be compiled into x64 without too much work.

Edit:

x86/x64 ColourLike: ColourLike-v1.0.1.zip (https://github.com/Reel-Deal/AviSynth-ColourLike/releases)

Version 1.0.1 (2022/01/30)
- Converted to AviSynth 2.6 / AviSynth+ plugin
- Added resource file
- x86/x64 plugins compiled with MSVC 2019

Compiled with the latest avs+ headers. No warnings or errors in MSVC so I assume it's all good. I did not test it, if it doesn't work, I probably wont be able to fix it :).

anton_foy
30th January 2022, 14:13
This is great stuff! I will try both ColourLike and MatchHistogram, even G'mic sounds interesting. Some parts I maybe have to leave outside of Avisynth but would preferably have everything 'under the same roof'.
Great work Reel.Deel!
Thank you guys!

StainlessS
30th January 2022, 16:12
Thanx RD, I had presumed that PDR had meant to say that MatchHistogram (not ColorLike) worked in mp_pipeline (as he said was better, and that is the link he gave).

poisondeathray
30th January 2022, 16:24
Sorry for confusion, it's what RD said. And thanks for the x64 version of colourlike (notice the "u" there, looking at "U" , SS :D )

vcmohan has HistogramAdjust (I think it is renamed to TweakHist) , but I haven't had much luck with that one in the past

StainlessS
30th January 2022, 18:08
Yip, I is sometimes affected by those nasty americanisms,
how you spell that in Canada ? [with a 'u' I is guessin']


EDIT: To Below,
"Cun'ada", HeHeHe :)

anton_foy
30th January 2022, 21:53
Yip, I is sometimes affected by those nasty americanisms,
how you spell that in Canada ? [with a 'u' I is guessin']

Cun'ada...yea makes sense. No offense :D

TweakHist from Manyplus seems like a good option too, I do not understand the parameters too much though I have to do some trial and error.