View Single Post
Old 1st July 2013, 23:00   #7  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,373
Meh, not great, but better than before. EDIT - agreed, a GUI would have been helpful.


Code:
#avisynth

C1=ImageSource("sgrad-test-1.jpg")
C1=C1.Crop(0, 0, 512, 384).ConvertToYV12()

## original image
#return C1

#@func SGradation2(clip clp, val "gammalite", val "gammadark")

## less midrange contrast
C2=C1.SGradation2(0.3, 0.3)

## more overall contrast
C2=C2.Levels(42, 1.0, 192, 16, 235)  

## stage one complete
#return C2

### optional ###

LoadModule("avslib", "filters", "channels") 

## clamp red, hackishly (EDIT: should have used Limiter)
V=C2.ShowV
V=V.Levels(0, 1.0, 160, 0, 255, coring=true) 
V=V.Levels(0, 1.0, 255, 0, 160) 

C3=MergeYUV(C2.ShowY, C2.ShowU, V)

## stage two complete
#return C3

### compare all ###

return StackVertical(
\              C1.Histogram(mode="levels").Subtitle("before"), 
\              C2.Histogram(mode="levels").Subtitle("SGrad+Levels"), 
\              C3.Histogram(mode="levels").Subtitle("clamp red"))

Last edited by raffriff42; 16th March 2017 at 14:41. Reason: (fixed image link)
raffriff42 is offline   Reply With Quote