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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 25th January 2013, 06:28   #1  |  Link
xekon
Registered User
 
Join Date: Jul 2011
Posts: 224
colorYUV - color correction, remove color cast. autowhite behavior?

I got an idea after reading this guide: http://www.kanzenshuu.com/forum/view...hp?f=7&t=19448

In that guide it makes a very good point:

The reason we do not want to do a straight white balance is because we do not want to change the overall tonality of the colors; we just want to remove remove the excess color added by the aging but keep the brightness/contrast as close as possible as to what's on the Dragon Box already. We can do any kind of contrast/brightness adjustment later in a more controlled fashion.

The Idea I got was to take the results of ColorYUV(autowhite=true) for a section of a particular frame, and apply that to the entire clip (the same idea from Ashura's guide on kanzenshuu)
Using only ColorYUV would allow me to skip converting to rgb and then back to yv12.

What I do first is find a frame that shows a nice close up of their eye, something that should be white/grey without color. Then get the coordinates within that frame that are just the eye.



My question first is about the autowhite feature of colorYUV, does it adjust brightness or contrast? or does it only adjust the color to restore white/greys (hoping just color)

I did a little test (these are the section of eye seen above, cropped and enlarged.):




I can see that the values for Y did not change, so my gut is telling me that the brightness/contrast is not changed, only the colors. because the U & V are for the colors and the Y is for the brightness/intensity as I understand it.
(I am still new to all of this, so please correct me if im wrong)

so If I could expose the results or values that colorYUV applies when running autowhite on one specific frame cropped to a section that is just white like a section of their eyes, then I could take those results and apply them to the entire clip.

I was thinking maybe the same way it shows results with analyze=true it could show the parameters used from the autowhite result.

Last edited by xekon; 25th January 2013 at 07:25.
xekon is offline   Reply With Quote
Old 25th January 2013, 09:18   #2  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
regarding the color cast removing process, i would suggest you go with the Adobe Premiere routine using the RGB parade scope. When you're doing it in avisynth, first crop out the part where you think should be white, size doesn't matter, and then apply the HistogramRGBParade here to see the rgb parade scope. From there all you need to do is line up rgb values horizontally like this:

(point to image 1)

you can achieve this by using fast color corrector or an RGB curve in premiere. If I'm not mistaken, the fast color corrector acts similar to coloryuv where they both only affect hue without touching luminance, which is not a good choice for removing color cast for anime. You wanted your color corrector to affect luminance, or it will end up something like this. As seen in that uses of coloryuv, the author kind of got the white balance from blind guess, but then when you look at the shadow area, it all turned to green. RGB curve is a much better choice here:

(point to image 2)

But sadly, i don't know if there's any script that simulate the rgb curve in avisynth.




I've read Ashura's post too a week ago, the color correction that he does was also a blind guess. For removing color cast, you need to first keep notice what version of dragon box you have, see the comparison here:
http://www.youtube.com/watch?v=rVQYcCtoGGA

the US version are brighter than the JP version, so if you got the US version, you need to return it to the jp level range first before removing color cast.

And as for color correction after that, do you have a reference? How do you know if the color is right or wrong? Blind guess is not going to get you anywhere.
Attached Images
  

Last edited by lansing; 25th January 2013 at 17:44. Reason: add image pointer
lansing is offline   Reply With Quote
Old 25th January 2013, 11:55   #3  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by xekon View Post
I can see that the values for Y did not change, so my gut is telling me that the brightness/contrast is not changed, only the colors.
That's correct.

Quote:
so If I could expose the results or values that colorYUV applies when running autowhite on one specific frame cropped to a section that is just white like a section of their eyes, then I could take those results and apply them to the entire clip.
All autowhite=true does is to set off_u and off_v dynamically for each frame to make the average U and V values equal 127 for that frame. So you could get the average values for a white/grey section from analyse=true and apply the offsets manually.

Taking your example, the average U and V of the 'eye' section are 121.78 and 131.55, so you would use off_u=5.22, off_v=-4.55.

However, as lansing suggests, you may get better results doing the correction in RGB.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 25th January 2013, 19:51   #4  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
in addition, don't use the auto white balance function, because it will fail most of the time.

For accurate color cast removal, you need to have some kind of graph like the RGB parade and wave form histogram to monitor the color and brightness. Blind guessing out of the sky is not a good practice.

here's a before and after with RGB curve in premiere, white reference from the same screen shot of bulma's eye:




in comparison to the one Ashura did, the brightness is more reasonable, and you don't need to do all those messes with photoshop to virtualdub import.
Attached Images
  

Last edited by lansing; 25th January 2013 at 19:53.
lansing is offline   Reply With Quote
Old 25th January 2013, 21:23   #5  |  Link
xekon
Registered User
 
Join Date: Jul 2011
Posts: 224
Wow! awesome guys, thanks for all the examples and help, and now I know what autowhite was doing too.

Quote:
Originally Posted by lansing View Post
But sadly, i don't know if there's any script that simulate the rgb curve in avisynth.
GiCoCu is supposed to be able to use the curve files created in adobe: http://avisynth.org.ru/docs/english/...ers/gicocu.htm

rgb curves from gimp:
GiCoCu("D:\Captures\gimp.cur")

rgb curves from adobe:
GiCoCu("D:\Captures\adobe.amp")

I did read one post saying that GiCoCu may not be accurately reproducing the effect. I will have to see where it was I saw that post.

I tried out HistogramRGBParade(), it shows the issue good, but it sounds like lansing you are doing the correction work right in premier instead of Avisynth.
So is HistogramRGBParade mostly to check your work after making the corrections? and you just check it on multiple frames on white/gray only areas i take it?

Last edited by xekon; 25th January 2013 at 21:29.
xekon is offline   Reply With Quote
Old 25th January 2013, 23:01   #6  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Quote:
Originally Posted by xekon View Post
I tried out HistogramRGBParade(), it shows the issue good, but it sounds like lansing you are doing the correction work right in premier instead of Avisynth.
So is HistogramRGBParade mostly to check your work after making the corrections? and you just check it on multiple frames on white/gray only areas i take it?
yes the HistogramRGBParade is used only to monitor the color during the process, you'll eventually remove it after you're done.

and yes i work entirely with premiere when dealing with color correction, because I can do it a lot faster with a gui, and avisynth doesn't have the necessary functions in order for me to do it in yet, like the RGB curve.
lansing is offline   Reply With Quote
Old 29th January 2013, 04:38   #7  |  Link
LemMotlow
Registered User
 
Join Date: Jul 2011
Location: Tennessee, USA
Posts: 266
r s

Last edited by LemMotlow; 1st March 2013 at 10:43.
LemMotlow is offline   Reply With Quote
Old 29th January 2013, 07:48   #8  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Quote:
Originally Posted by LemMotlow View Post
Mmm, well...not quite a complete fix. Look in the attached "before" image where the leaves in dark shadow are dark green, and the dark side of the palm tree is dark brown. In the attached "after" pick, all the shadow areas are blue. Not good.
that was just a quick example of doing the color cast removal with RGB curve, and I don't know how it originally looks like. You are free to adjust it to your liking, it's pretty easy.
lansing is offline   Reply With Quote
Old 29th January 2013, 10:19   #9  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
i'll add my color correction attempt (well i think color match seems more appropriate) here for future reference. The colors were not adjusted from blind guesses, i'm referencing from the FUNimation dragon ball z level set bluray, which has the correct color. The source i'm working on is the R2 dragon box.

The color correction process was done by eyes, so some color may still be off. Filters used were a RGB curve, a three-way color corrector, and a HSL color corrector with eight hue to play with. I couldn't figure out an ideal order of workflow though. So if i changed one parameter in the chain, every other parameter after it have to be changed, which is not a good approach. Well i'll figure it out eventually.

The left is the R2 dragon box, the middle is the level set, and the right is my color correction.

(see images)

I think it should be possible to match all the color if given more time. One problem is that the HSL controller plugin i used cause artifacts some time.
Attached Images
   
lansing is offline   Reply With Quote
Old 29th January 2013, 13:04   #10  |  Link
LemMotlow
Registered User
 
Join Date: Jul 2011
Location: Tennessee, USA
Posts: 266
/xxx5

Last edited by LemMotlow; 1st March 2013 at 10:42.
LemMotlow is offline   Reply With Quote
Old 20th May 2013, 14:20   #11  |  Link
Kisa_AG
Registered User
 
Join Date: Sep 2005
Location: Moscow, Russia
Posts: 65
Hello!

Here is my function for grey balance correction, which is based on Black/White/Gray Balance picker like in Photoshop or other image editing applications.

Usig of Gray_Balance script has two stages.
########### Stage 1 ############
Finding RGB values for Black/White/Gray Balance.

write a script like this:
YourSource("yourfile")
Gray_Balance(TestMode=True)
Save this script with an ".avs" extension.

You can even use Gray_Balance(131,127,113,TestMode=True) or any other string, because everything is ignored while TestMode=True.
Then open this .AVS script in VirtualDub, find a frame with an object which should be gray. Copy this frame to clipboard (Ctrl+1).
Go to any image edidting application (Photoshop, GIMP, whatever), paste the frame, choose the picker tool and grab the RGB values for the object, which should be gray. (It's better to use the object in semitones, i.e. it's RGB values should be, let's say, somewhere in between 80-180).
Another approach is to use any screen picker like ColorCop to grab RGB values directly from VirtualDub.
It seems that the resualt should be absolutely the same.

########### Stage 2 ############
Applying color correction.
Open script in Notepad again, remove TestMode=True and enter RGB values grabbed in the first stage as RG, GG and BG. E.g.: Gray_Balance(131,127,113).
You can do the same to set Black and White points of the clip, if you want.
Like here:
-----------------------
# RGB for Gray Object
RG=110
GG=113
BG=102

# RGB for Black Point
R0=0
G0=0
B0=0

# RGB for White Point
RW=197
GW=200
BW=180

Gray_Balance(RG,GG,BG,R0,G0,B0,RW,GW,BW, Interlaced=False, Matrix_In="PC.709", Matrix_Out="PC.709", TestMode=False).
------------------------

Now you can open your .AVS script in VirtualDub to check what happend. If everything was done correctly,
then you should see your gray object really perfectly gray. The overall gray balance should also become more correct.
Curves approximation is based on Quadratic Polynomials.
Here are the before/after sample pictures.
Attached Images
  
Attached Files
File Type: zip Gray_Balance_1.zip (2.7 KB, 563 views)
Kisa_AG is offline   Reply With Quote
Old 5th December 2014, 03:03   #12  |  Link
xekon
Registered User
 
Join Date: Jul 2011
Posts: 224
Thanks for sharing this, I am going to try it out
xekon is offline   Reply With Quote
Old 2nd February 2015, 05:52   #13  |  Link
supersaiyangoku
Registered User
 
Join Date: Jan 2015
Posts: 4
i can't seem to do the color correction of the dragon box can you help?
supersaiyangoku is offline   Reply With Quote
Old 2nd February 2015, 16:25   #14  |  Link
Stormborec
Registered User
 
Join Date: Feb 2013
Posts: 161
I've made (in fact not me) something similar, that works ... similar ... but I don't know, what you want
Stormborec is offline   Reply With Quote
Old 5th February 2015, 04:18   #15  |  Link
supersaiyangoku
Registered User
 
Join Date: Jan 2015
Posts: 4
i don't know what software i need to remove the color cast and make the set i have color accurate. can you please help the kanzenshuu forum page on this didn't seem to help the software didn't work can you help me?
supersaiyangoku is offline   Reply With Quote
Old 6th February 2015, 08:58   #16  |  Link
Overdrive80
Anime addict
 
Overdrive80's Avatar
 
Join Date: Feb 2009
Location: Spain
Posts: 673
IMHO, I dont think that this task is too easy, and you never get original colorimetry. Why?

Because, Toei shooting the films applying some type of photografic filter (look left border, you can see original colorimetry):





You can use on Premiere, "Lumetri Looks-->Temp" to reduce colours too yellowed

- Without filter cold



- With filter cold, you can play with mask for setting nivel of opacity



Too you can use more filters like "Corrección rápida", in english I dont know like premiere name it:



Frame without cropping:

__________________
Intel i7-6700K + Noctua NH-D15 + Z170A XPower G. Titanium + Kingston HyperX Savage DDR4 2x8GB + Radeon RX580 8GB DDR5 + ADATA SX8200 Pro 1 TB + Antec EDG750 80 Plus Gold Mod + Corsair 780T Graphite

Last edited by Overdrive80; 7th February 2015 at 08:40.
Overdrive80 is offline   Reply With Quote
Old 8th February 2015, 02:50   #17  |  Link
supersaiyangoku
Registered User
 
Join Date: Jan 2015
Posts: 4
you didn't really answer my question what tools do i need to do this color correction? also what are talking about you can never get the right color is there anyway or at the least get them close enough to them? please answer both questions.

Last edited by supersaiyangoku; 8th February 2015 at 02:54.
supersaiyangoku is offline   Reply With Quote
Old 8th February 2015, 07:42   #18  |  Link
Overdrive80
Anime addict
 
Overdrive80's Avatar
 
Join Date: Feb 2009
Location: Spain
Posts: 673
Yes, I answered to your question:

1. Lansing and I, have recommended to use Adobe Premiere when I said: "You can use on Premiere, "Lumetri Looks-->Temp" to reduce colours too yellowed". However, you are who should choose one program for working (Adobe After effects, Sony Vegas, Blackmagic Davinci, avisynth, larger etc...)

2. For getting them close enough to them, you need original broadcasting material for doing a comparison. Have you this material??
__________________
Intel i7-6700K + Noctua NH-D15 + Z170A XPower G. Titanium + Kingston HyperX Savage DDR4 2x8GB + Radeon RX580 8GB DDR5 + ADATA SX8200 Pro 1 TB + Antec EDG750 80 Plus Gold Mod + Corsair 780T Graphite

Last edited by Overdrive80; 10th February 2015 at 18:28. Reason: grammar
Overdrive80 is offline   Reply With Quote
Old 8th February 2015, 19:19   #19  |  Link
supersaiyangoku
Registered User
 
Join Date: Jan 2015
Posts: 4
answer to number 2 no but do you know where i can find any info on this? also what's with color being different on the sides? answer both questions.

Last edited by supersaiyangoku; 8th February 2015 at 19:21.
supersaiyangoku is offline   Reply With Quote
Old 9th February 2015, 20:32   #20  |  Link
LemMotlow
Registered User
 
Join Date: Jul 2011
Location: Tennessee, USA
Posts: 266
Quote:
Originally Posted by supersaiyangoku View Post
answer to number 2 no but do you know where i can find any info on this? also what's with color being different on the sides? answer both questions.
The color on the left side border of the images was explained in post #16 at the top of the post. I don't think that comparing the original disc recording will help if you don't know what a color filter is.

In Avisynth use "ColorYUV(autowhite=true)" or AutoAdjust.

In VirtualDub use ColorMill.

No one can answer your question with any detail because no one knows what your video looks like. Just saying that you want to correct a "blue color balance" doesn't tell us anything. The simple answer is to reduce the amount of blue in the video. But we don't have a sample of your video and you won't tell us what software you use, so you can get only very general answers.

Last edited by LemMotlow; 9th February 2015 at 20:35.
LemMotlow is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:39.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.