View Full Version : Gamma correction without ruining the very bright and very dark parts?
zee944
16th November 2008, 17:55
It has always been painful for me to use gamma correction. Even with low values it affected too heavily the very bright and very dark parts of the image. So the end result was always a little disappointing with the seemingly ruined black leves and burnt-out bright parts.
Is there a "smart gamma correction" which leaves the dark and bright areas intact and affects only the midtones? I was thinking about using a levels curve like this:
http://i179.photobucket.com/albums/w286/zee944/gamma1.jpg
...or even (relatively close to Didée's Ylevels (http://forum.doom9.org/showthread.php?t=79898) script):
http://i179.photobucket.com/albums/w286/zee944/gamma2.jpg
instead of this (the usual gamma curve):
http://i179.photobucket.com/albums/w286/zee944/gamma3.jpg
Theoretically this can be done with GiCoCu (loading an already-drawn arbitrary gamma curve), but that's extremely unpractical, thus time consuming when you have a fair amount of scenes to do. The adjustable strength is essential (that's not possible in GiCoCu) and so is the possibility to use it in the opposite direction (= darkening the image like gamma(0.7) does).
Any ideas? Thank you for any inputs.
Gavino
16th November 2008, 19:20
You asked the same question back in February and seemed satisfied with Didée's answer (to use GiCoCu). Did it not do what you wanted?
rfmmars
16th November 2008, 19:24
Use HDRagc or Virtualdub plugin by Fdump (RGBeq V 2.1) With r,b, and G boxes checked, choose 17 sliders, have at it. View the histagram and live preview at the bottom.
Richard
photorecall.net
zee944
16th November 2008, 20:22
You asked the same question back in February and seemed satisfied with Didée's answer (to use GiCoCu). Did it not do what you wanted?
That question was for the arbitrary curve for special cases. In simple cases, when I only want to brighten/darken the image and I'd set just one parameter like I do with gamma(1.2) or gamma(0.7), GiCoCu is extremly unpractical.
Use HDRagc or Virtualdub plugin by Fdump (RGBeq V 2.1) With r,b, and G boxes checked, choose 17 sliders, have at it. View the histagram and live preview at the bottom.
RGBeq seems a fine alternative to GiCoCu, but can I control it from AVISynth? Especially the strength value?
Adub
16th November 2008, 20:41
LoadVirtualDubPlugin()
LaTo
17th November 2008, 19:21
That question was for the arbitrary curve for special cases. In simple cases, when I only want to brighten/darken the image and I'd set just one parameter like I do with gamma(1.2) or gamma(0.7), GiCoCu is extremly unpractical.
It's possible to do this with mt masktools, but I haven't time now... Maybe this week end :)
Mug Funky
19th November 2008, 05:10
generally rasing gamma means having to crush the black point and possibly lower the white point a smidge to compensate for the brightening it creates.
custom curves are only useful in certain specific situations (like "p2 camera in overlit indoor scene", or "fuji being cut with kodak"), and even then they're of limited use.
you'd have to treat every shot separately though... there are people whose entire job is doing this btw and it pays pretty well :)
bagheera1
19th November 2008, 13:20
Check out this http://forum.doom9.org/showthread.php?p=631400#post631400
I've been using DiDee's Custom Blurring script with good results for a while now.
LaTo
19th November 2008, 21:44
Here is my proposition/function:
function LimitedGamma(clip clp, float "gamma", int "strength") {
clp.mt_lut(Yexpr="x 255 / 333 106 / * sin "+string(float(strength)/100.0)+" ^ x 255 / 1 "+string(gamma)+" / ^ 255 * x - * x +",U=2,V=2)
return last }
2 parameters: gamma (float) & strength (int)
For strength: the higher, the less black & bright parts are processed
Examples:
LimitedGamma(gamma=1.0,strength=0) # do nothing
LimitedGamma(gamma=2.0,strength=0) #do a normal gamma conversion: Levels(0,2.0,255,0,255)
LimitedGamma(gamma=2.0,strength=50) # do less conversion on black & bright parts
LimitedGamma(gamma=2.0,strength=150) #do much less conversion on black & bright parts
:devil:
cyberbeing
19th November 2008, 23:12
Since it is somewhat related, would anybody be willing/able to make a GiCoCu like avisynth filter that uses Photoshop Shadow/Highlight presets (*.shh) to do Photoshop-like Shadow/Highlight adjustments? Is that too much of a proprietary Photoshop function to reproduce in avisynth?
Mug Funky
20th November 2008, 01:54
i hadn't seen that PS filter before. it must be new.
seems like it's a masking between adjusted highlight, adjusted shadow and the original with some blurring in the masking part.
this could be mimicked with an avs function i think. you'll have to work in RGB or expect weird results though.
however, IMHO the results are sorta ugly. i think this kind of work is more suited to a fully-fledged colour grading program. it'd be sweet if avisynth were GUI'd and supported 10+ bits. but with a free good quality grading program Apple would start suing i think (because theirs is not free, and crap quality but the nearest competitor for budget stuff).
cyberbeing
20th November 2008, 02:46
I think Shadow/Hightlight was introduced in Photoshop CS (2004). I use it often in Photoshop as it's a nice tool for increasing/reducing shadow and highlight detail as well as increasing/reducing contrast and tweaking midtones of your image without completely messing it up with levels or curves. No idea how well it would work on video though.
Blue_MiSfit
20th November 2008, 09:11
Shadow/HIghlights in photoshop is very similar to pseudo-HDR, which is what HDRAGC does. You'd probably be able to achieve similar results with HDRAGC.
I really like Adobe Lightroom's excellent control over RAW images in this regard :)
~MiSfit
Adub
20th November 2008, 10:45
I just wish that more images were available in RAW format. Right now, I can't even afford a camera that takes RAW images. (college student).
zee944
21st November 2008, 22:04
Examples:
LimitedGamma(gamma=1.0,strength=0) # do nothing
LimitedGamma(gamma=2.0,strength=0) #do a normal gamma conversion: Levels(0,2.0,255,0,255)
LimitedGamma(gamma=2.0,strength=50) # do less conversion on black & bright parts
LimitedGamma(gamma=2.0,strength=150) #do much less conversion on black & bright parts
:devil:
LaTo, this is genius. Thank you. Very simple, yet effective.
Ugh... I know I'm getting avid, but can you change it to have two strength parameters, so I could handle the black and bright parts differently? :D
LaTo
22nd November 2008, 07:47
LaTo, this is genius. Thank you. Very simple, yet effective.
Ugh... I know I'm getting avid, but can you change it to have two strength parameters, so I could handle the black and bright parts differently? :D
function LimitedGamma2(clip clp, float "gamma", int "dark_str", int "bright_str") {
clp.mt_lut(Yexpr="x 128 <= x 255 / 333 106 / * sin "+string(float(dark_str) /100.0)+" ^ x 255 / 1 "+string(gamma)+" / ^ 255 * x - * x +"
\ +" x 255 / 333 106 / * sin "+string(float(bright_str)/100.0)+" ^ x 255 / 1 "+string(gamma)+" / ^ 255 * x - * x + ?",U=2,V=2)
return last }
LimitedGamma2(gamma,dark_str,bright_str) ;)
zee944
22nd November 2008, 16:58
LimitedGamma2(gamma,dark_str,bright_str) ;)
You've saved my life. :D
Thanks for everyone for the hints, LimitedGamma2 works like a charm. Should be a built-in AviSynth function.
manono
22nd November 2008, 23:01
Thanks from me as well, LaTo. I can use those 2 functions.
LaTo
26th November 2008, 17:03
Now LimitedGamma is totally integrated in SmoothLevels v1.00 with some new features... Try it! ;)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.