Zarxrax
25th August 2005, 21:15
Noticing that dark scenes tend to look absolutely horrible (in anime at least), I would seem to think that perhaps these dark scenes ought to be filtered differently than the rest of the video? Has anyone already made any functions to achieve this? If not, what filters or commands might I want to look into for testing the luminance value of a frame?
mg262
25th August 2005, 21:55
ConditionalFilter, ScriptClip and AverageLuma...
Look up the first two in the documentation and it will have everything you need; shout if there's any trouble!
Didée
26th August 2005, 08:10
You can do much more simple, like
Filter_normal = [... your usual filtering ...]
Filter_dark = [... stronger or additional filtering for dark scenes ...]
Brightness = Filter_normal [ + levels/gamma adjustment acc. to taste & needs]
MaskedMerge( Filter_normal, Filter_dark, Brightness.FitY2UV(), U=3,V=3 )
frank10
6th December 2005, 12:05
I have this similar problem (not a cartoon) and I tried the ConditionalFilters to detect scene change to change then the filters based on Luminance and it worked well:
a = AviSource("D:\Temp\test.avi")
global a = ConvertToYV12()
global scene_normal = a.Tweak(0.0,1.2,0.0,1.3)
global scene_dark = a.Tweak (0.0, 1.6,0.0,2.0)
Function adaptLuma(clip c)
{
#This conditional controls the averageLuma and choices dark or normal:
ConditionalFilter(a, scene_normal , scene_dark, "AverageLuma()", ">", "40")
}
#this conditional controls when there is a scene change:
c = ScriptClip(a, """ConditionalFilter(a, adaptLuma, a , "diff", "<", "-7") """)
c = FrameEvaluate (c, "global diff = YDifferenceToNext(a)-YDifferenceFromPrevious(a)")
return c
BUT
The problem is that it changes only the first frame of the scene that has just changed.
I want instead to mantain the settings for all the frames from a scene change to the next change (obviously).
How can I do this?
btw1: I tried only the Conditional based on Luma, but it happens that you get a slightly variations under the threshold in a scene and that way it changes for few frames only giving a 'flash' of brightness...
So I decided to detect and filter the entire scene, based on the other conditional and change contrast only if there was a change.
btw2: I tried Didée suggestion and it works, but it blends too much the two settings in every frames. I want a more precise control, in this video, over different luma conditions, since I tried the above script.
Besides, how do you set correctly the levels in the brightness?
I did:
scene_normal = a.Tweak(0.0,1.2,0.0,1.3)
scene_dark = a.Tweak (0.0, 1.6,0.0,2.0)
brightness = a.levels(0, 1, 255, 0, 255)
MaskedMerge(scene_normal, scene_dark, brightness.fity2uv() ,U=3,V=3)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.