From Avisynth wiki
Jump to: navigation, search
Author V. C. Mohan
Version 18 oct 2015
Download HistogramAdjust_2_6.zip
Category External filters
License GPLv2
Discussion Doom9 Forum


[edit] Description

HistogramAdjust, adjusts the histogram of a frame by either equalizing it or by matching with histogram of another image, or with given histogram table of values. Windowed equalization. In this mode the window for deriving the input clip histogram, steps half window size each time. This windowed processing may not be suitable for all images. Possible blocky appearance. 3 window sizes for coarse, medium and fine output. Use of small value for limit may give better results

If matching with given table values, then matching clip need not be specified. The second parameter is a table of integer pairs.Each pair consists of Luma (intensity) value and the second number is population (type = 4) or cumulative population (type = 5) at this value.The table is normalized by the plugin and so approximate values are OK. Due to limitation of number of parameters that can be input through AviSynth, not more than 25 pairs can be specified. It will be possible to input by table any desired histogram shape. The plugin linearly interpolates and extrapolates to construct a full normalized histogram from these values. In case of RGB input the selected color histogram is adjusted. For other formats Y value histogram is adjusted.

  • For AviSynth+ see modPlus, includes high bit depth colorspace support and 64-bit.

[edit] Requirements

[edit] Syntax and Parameters

TweakHist (clip, int*, int "type", clip "mclip", int "mf", int "limit", int "wsize", int "rgb")

clip   =
Input clip.

clip   =
The following is a table of Histogram values, to be specified only if table is true.
  • Luma value: integer, 0 to 255 and to increase monotonically.
  • Population or cummulative population at this luma value: integer, non negative. In case of type=5, should monotonically increase and Max value is 256.

int  type = 1
Type of process:
  • 1 : full frame equalization
  • 2 : windowed equalization
  • 3 : matching with specified frame
  • 4 : matching with given table of Luma, population
  • 5 : luma vs cummulative population

clip  mclip =
Clip in which image for matching is available. Valid clip to be specified only if required.
Input clip to be processed and clip to be used for matching do not need to have identical color formats and dimensions.
For example processing clip can be YV12, 720 X 480 pixels while matching clip is YV16, 256 X 16 pixels.

int  mf = 0
Frame number on clip for matching

int  limit = 100
Limit on % of change in value allowed.
  • Range: 1 to 100

int  wsize = 2
If windowed processing opted size of window.
  • 1 : coarse
  • 2 : medium
  • 3 : fine

int  rgb = 1
Color of RGB input to process:
  • 0 : Red
  • 1 : Green
  • 2 : Blue

[edit] Examples

HistogramAdjust(c,15,2, 30,12, 50, 33, 90, 12,150,35,200,10, type=4,limit=50)
HistogramAdjust(20,1,150,100,255,110, type=5,limit = 70)
  • RGB input. Repeated for each color
HistogramAdjust(limit = 70,rgb = 0)
HistogramAdjust(limit = 70,rgb = 1)
HistogramAdjust(limit = 50, rgb = 2)

Back to External Filters

Personal tools