GamMatch(), [Gamma Matcher]. Useful to correct bad color clip where there is a better color source of perhaps lower rez available. Additional tweaking via RedMul, GrnMul and BluMul multipliers. GamMatch, Allows to correct a clip that has had Levels + Gamma badly applied, to one of more channels, by using an in sync version clip with good un-messed with color, but perhaps of inferior resolution. GamMatch is unlikely to be of any use where eg Tweak or some other non RGB levels type mod has been applied.
What it does(roughly):- Alter bad source color clip channel minimums, maximums and averages to match dc detect (good color) clip.
- *** vcredist_x86.exe is required for GamMatch-x86
- *** vcredist_x64.exe is required for GamMatch-x64
GamMatch(Clip c,clip dc, \ Float "RedMul"=1.0,Float "GrnMul"=1.0, Float "BluMul"=1.0, \ Float "Th"= 0.00,Float "loTh"=Th,Float "hiTh"=Th, \ int "RngLim"=11,Float "GamMax"=10.0, \ int "x"=20,int "y"=20,int "w"=-20,int "h"=-20, \ Bool "Show"=True,int "Verbosity"=2,Bool "Coords"=false \ ) c, no default. Bad Color source clip. dc, no default. Detection clip (good color clip). Must be same ColorSpace and FrameCount as source clip, no other similarities enforced. RedMul, default 1.0 Red channel multiplier adjustment. [0.1 <= RedMul <= 10.0] GrnMul, default 1.0 Green channel multiplier adjustment. [0.1 <= GrnMul <= 10.0] BluMul, default 1.0 Blue channel multiplier adjustment. [0.1 <= BluMul <= 10.0] Th, Default 0.00 Sets Default for loTh and hiTh. Suggest Default, 0.00(percent). [-1.0(OFF) , or 0.0 -> 1.0] v0.05, NOTE, Default changed from 0.04 to 0.00. loTh, Default Th As for Ignore_low in AutoLevels, or Threshold in YPlaneMin. [-1.0, or 0.0 -> 1.0] Percent, amount of extreme pixels (eg noise) to ignore when finding minimum R, G or B channel values. -1.0 is OFF, input channel minimum is set to 0 as for levels(0,gamma,input_max, ... ). If loTh >=0.0, then will scan frame looking for lowest pixel value whose cumulative sum [including all pixels counts of lower value pixels] is greater than loTh%. loTh, only shown in metrics if greater or equal to 0.0 ie switched ON (Always shown when Verbosity=3=FULL). hiTh, Default Th As for Ignore_high in AutoLevels, or Threshold in YPlaneMax. [-1.0, or 0.0 -> 1.0] Percent, amount of extreme pixels (eg noise) to ignore when finding maximum R, G or B channel values. -1.0 is OFF, input channel maximum set to 255, as in levels(input_min,gamma,255, ... ). If hiTh >=0.0, then will scan frame looking for highest pixel value whose cumulative sum [including all pixels counts of higher value pixels] is greater than hiTh%. hiTh, only shown in metrics if greater or equal to 0.0 ie switched ON (Always shown when Verbosity=3=FULL). RngLim, default 11 [1 <= RngLim <= 32] If ALL THREE RAW input channel ranges ie (ChannelMax(max(hiTh,0.0))-ChannelMin(max(loTh,0.0))) are less than RngLim then all scaling is disabled, and remapping is linear without gamma estimation, to range omin -> omax, ie avoid remapping of Black, White frames, or single color frames. GamMax, default 10.0 Upper value for guess gamma [2.0 <= GamMax <= 10.0] Starting guess upper range and limit for gamma estimator (probably best left alone). The lower guess range and limit will be set to 1.0 / GamMax, by default 0.1. x,y, Both default 20. Area of dc Detect clip frame to sample when getting averages and estimating Gamma function, allows to ignore rubbish at frame edges. w,h, Both default -20. Specified as for crop eg x=10,y=20,w=-30,h=-40, as in crop(10,20,-30,-40). Show, default true True, show metrics info on frame. Verbosity, default 2 0 = Only upper frame metrics Flags line only 1 = Upper frame metrics 2 = Upper + important ones. (default) 3 = Nearly Full metrics. 4 = Full Metrics except version info 5 = Full Metrics including version info Upper frame metrics shown as eg:- (when Verbosity=5=FULL) nnnnn] Flags:- SR R G B DC: 3,251 7,247 5,251 DC_AVE: 73.875 62.033 70.528 >>>>>>>> RAW: 8,247 12,223 32,239 IN: 8,247 12,223 32,239 IN_AVE: 62.515 88.859 133.384 SCALED: 58.165 92.887 124.893 GAMMA: 1.240 0.640 0.486 OUTAVE: 73.875 62.032 70.529 <<<<<<<< This matching DC_Ave where, nnnnn, is the frame number. Flags:- (Specific to current frame, can change frame to frame) 'S' = Scale, mode signified by color. Greyed out. Scale = 0(No Effect). May be Greyed out if all channels Min/Max are 0,255. White. Scale = 1[Scales input channel average maximum dynamic range of R,G,B] Orange. Scale = 2[Scales input channel average dynamic range of R and G and B, Individually] 'R' = Limited by RngLim, mode signfied by color. Greyed out. Not Range Limited. Red, at least 1 channel has remapping disabled. DC: Shows comma separated channel minimum and maximum of DC clip(dependent upon loTh, hiTh). DC_AVE: DC Clip channel averages. RAW: Shows RAW comma separated channel minimum and maximum, eg ChannelMin(max(loTh,0.0)) and (ChannelMax(max(hiTh,0.0)), only shown if Verbosity>=3 or, if any RAW input range is less than RngLim AND any of the RAW inputs are different to the equivalent standard input. IN: Shows comma separated channel minimum and maximum (dependent upon Scale, loTh, hiTh). IN_AVE: Input channel averages. SCALED: Scaled input averages, (dependent upon Scale, loTh, hiTh, channel minimums and maximums). GAMMA: Estimated gamma to achieve OutAve for channel. (dependent upon pretty much everything). OUTAVE: Output channel average ie rendered result. DC and DC_AVE derived from DC (Good color clip), all others from clip c (BAD color clip, Incl OUTAVE). Coords, default False. If True, then shows DC clip with dotted lines showing the x,y,w,h coords plotted on frame. (All other GamMatch functionality disabled).
v0.05, 06 Jan 2019. Bug fixed in GuessGamma(), previously found gamma could have been slightly nearer than result. Changed default Th to 0.00.
 Archived Downloads
 External Links
Back to External Filters ←