HistogramAdjust

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with " {{FilterCat4|External_filters|Plugins|<!-- category -->TODO|<!-- category -->TODO}} {{Filter3 |1=<!-- author -->[http://www.avisynth.nl/users/vcmohan/ V.C.Mohan] |2=<!-- ver...")
 
(Update page to match HistogramAdjust)
 
(17 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
+
{{FilterCat4|External_filters|Plugins|Adjustment_filters|Levels_and_Chroma_filters}}
{{FilterCat4|External_filters|Plugins|<!-- category -->TODO|<!-- category -->TODO}}
+
 
+
 
{{Filter3
 
{{Filter3
|1=<!-- author -->[http://www.avisynth.nl/users/vcmohan/ V.C.Mohan]
+
|{{Author/vcmohan}}
|2=<!-- version -->1.0.0.0.0
+
|18 oct 2015
|3=<!-- download 2.5.8 version URL -->2.5.8 version[http://www.avisynth.nl/users/vcmohan/HistogramAdjust/HistogramAdjust.zip HistogramAdjust] 2.6.0 alpha5 version URL -->[http://www.avisynth.nl/users/vcmohan/HistogramAdjust/HistogramAdjust_2_6.zip HistogramAdjust]
+
|[http://www.avisynth.nl/users/vcmohan/HistogramAdjust/HistogramAdjust_2_6.zip HistogramAdjust_2_6.zip]
 
|4=<!-- category -->External filters
 
|4=<!-- category -->External filters
|5=<!-- license -->[http://www.gnu.org/licenses/gpl-2.0.txt GPLv2]
+
|5=<!-- license -->[https://www.gnu.org/licenses/gpl-2.0.txt GPLv2]
|6=<!-- discussion URL -->[http://forum.doom9.org/showthread.php?p=719889#post719889 HistogramAdjust  plugin]}}
+
|6=<!-- discussion URL -->[https://forum.doom9.org/showthread.php?p=719889#post719889 Doom9 Forum]}}
  
 
<br>
 
<br>
 
== Description ==
 
== Description ==
<!-- a one-sentence 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.
H and a full description is at [http://www.avisynth.nl/users/vcmohan/HistogramAdjust/HistogramAdjust.html click me].
+
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
<br>
+
 
 +
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.
 +
 
 +
 
 +
*Official documentation: http://www.avisynth.nl/users/vcmohan/HistogramAdjust/HistogramAdjust.html
 +
 
 +
*For AviSynth+ see [[modPlus]], includes high bit depth colorspace support and 64-bit.
 
<br>
 
<br>
 
== Requirements ==
 
== Requirements ==
* <!-- Avisynth version -->AviSynth 2.5.8 or [http://sourceforge.net/projects/avisynth2/files/AviSynth_Alpha_Releases/ 2.6.0 Alpha 5 or greater]
+
* [x86]: [[AviSynth+]] or [https://sourceforge.net/projects/avisynth2/ AviSynth 2.6]
* <!-- source video: progressive
+
* Supported color formats: [[RGB24]], [[RGB32]], [[YUY2]], [[Y8]], [[YV12]], [[YV16]], [[YV24]]
* <!-- color formats -->Supported color formats: [[YUY2]], [[YV12]], <span style="color:red">*</span>[[YV16]], <span style="color:red">*</span>[[YV24]], <span style="color:red">*</span>[[YV411]], <span style="color:red">*</span>[[Y8]]
+
: <span style="color:red">*</span> Not available in AviSynth 2.5.8.
+
* <!-- CPU/GPU -->
+
* <!-- binaries -->
+
* <!-- dependent plugins -->
+
 
<br>
 
<br>
"ci*[type]s[table]b[mclip]c[mf]i[window]b[w]i[h]i[limit]i"
 
 
== [[Script variables|Syntax and Parameters]] ==
 
== [[Script variables|Syntax and Parameters]] ==
:{{Template:FuncDef|<!-- function name -->HistogramAdjust(''clip'', ''<!-- par 1 type -->int array'' "<!-- par 1 name -->", ''<!-- par 2 type -->string'' "<!-- par 2 name -->type", ''<!-- par 3 type -->bool'' "<!-- par 3 name -->table ",''<!-- par 4 type -->clip'' <!-- par 4 name -->mclip",''<!-- par 5 type -->int'' <!-- par 5 name -->mf",''<!-- par 6 type -->bool'' <!-- par 6 name -->window",''<!-- par 7 type -->int'' <!-- par 7 name -->w",''<!-- par 8 type -->int'' <!-- par 8 name -->h",''<!-- par 9 type -->int'' <!-- par 9 name -->limit")}}
+
:{{Template:FuncDef|TweakHist (clip, int*, int "type", clip "mclip", int "mf", int "limit", int "wsize", int "rgb")}}
 
<br>
 
<br>
 
::{{Par2| |clip| }}
 
::{{Par2| |clip| }}
:::Input clip.      
+
:::Input clip.
 
<br>
 
<br>
::{{Par2|<!-- par 1 type -->int array|<!-- par 1 name -->|<!-- par 1 default value -->}}
+
::{{Par2| |clip| }}
:::<!-- par 1 description -->table of luma and population pairs in case table is true .
+
:::The following is a table of Histogram values, to be specified only if <code>table</code> 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 <code>type=5</code>, should monotonically increase and Max value is 256.
 
<br>
 
<br>
::{{Par2|<!-- par 2 type -->string|<!-- par 2 name -->type|<!-- par 2 default value -->"equal"}}
+
::{{Par2|type|int|1}}
:::<!-- par 2 description -->"equal" or "match"
+
::: 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
 
<br>
 
<br>
::{{Par2|<!-- par 3 type -->bool|<!-- par 3 name -->table|<!-- par 3 default value -->false}}
+
::{{Par2|mclip|clip|}}
:::<!-- par 3 description -->Whether table of values are specified for matching Histogram.
+
::: 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.
 
<br>
 
<br>
::{{Par2|<!-- par 4 type -->clip|<!-- par 4 name -->mclip|<!-- par 4 default value -->clip}}
+
::{{Par2|mf|int|0}}
:::<!-- par 4 description -->Clip with which input clip histogram is to be matched .
+
:::Frame number on clip for matching
 
<br>
 
<br>
::{{Par2|<!-- par 5 type -->int|<!-- par 5 name -->mf|<!-- par 5 default value -->0}}
+
::{{Par2|limit|int|100}}
:::<!-- par 5 description -->frame number of mclip with which clip histogram is to be matched .
+
::: Limit on % of change in value allowed.
 +
:::* Range: 1 to 100
 
<br>
 
<br>
::{{Par2|<!-- par 6 type -->bool|<!-- par 6 name -->window|<!-- par 6 default value -->false}}
+
::{{Par2|wsize|int|2}}
:::<!-- par 6 description -->Whether windowed equalization is to be done .
+
:::If windowed processing opted size of window.
<br>
+
:::*1 : coarse
::{{Par2|<!-- par 7 type -->int|<!-- par 7 name -->w|<!-- par 7 default value -->frame width/4}}
+
:::*2 : medium
:::<!-- par 7 description -->If window is true, width of window (odd number) to be used.
+
:::*3 : fine
 
+
<br>
+
::{{Par2|<!-- par 8 type -->int|<!-- par 8 name -->h|<!-- par 8 default value -->frame height/4}}
+
:::<!-- par 8 description -->If window is true, height of window (odd number) to be used.
+
<br>
+
::{{Par2|<!-- par 9 type -->int|<!-- par 9 name -->limit|<!-- par 9 default value -->100}}
+
:::<!-- par 9 description -->percentage of deviation from original value of luma to be allowed .
+
<br>
+
 
+
 
<br>
 
<br>
 +
::{{Par2|rgb|int|1}}
 +
:::Color of RGB input to process:
 +
:::*0 : Red
 +
:::*1 : Green
 +
:::*2 : Blue
 
<br>
 
<br>
  
 
== Examples ==
 
== Examples ==
<!-- example code block: 1st char in each line = space -->
+
 
  ## This is some example code to blur  an image.
+
  HistogramAdjust()
  imagereader("C:\..........jpg", end = 10)
+
  HistogramAdjust(c,type=3,mclip=mm,mf=26)
a = avisource("C;\..........avi").converttoYUY2()
+
  HistogramAdjust(c,15,2, 30,12, 50, 33, 90, 12,150,35,200,10, type=4,limit=50)
  converttoyv16()
+
  HistogramAdjust(20,1,150,100,255,110, type=5,limit = 70)
# HistogramAdjust matching with given table
+
 
m1=HistogramAdjust(1,250,100,570,200,0,type="match",table=true, window=false,w=259,h=255)
+
*RGB input. Repeated for each color
  # matching with an image on a frame of another clip
+
 
h2 = HistogramAdjust(type="match",table=false, mclip=a ,mf=1)
+
  HistogramAdjust(limit = 70,rgb = 0)
# Histogram equalization
+
  HistogramAdjust(limit = 70,rgb = 1)
  HistogramAdjust()
+
  HistogramAdjust(limit = 50, rgb = 2)
  # equalization with limit
+
  h1 = HistogramAdjust( limit = 80)
+
 
<br>
 
<br>
 +
<br>
 +
-----------------------------------------------
 +
'''Back to [[External_filters#Levels_and_Chroma|External Filters]] &larr;'''
 
-----------------------------------------------
 
-----------------------------------------------
'''Back to [[External_filters|External Filters]] &larr;'''
 

Latest revision as of 03:30, 8 June 2020

Abstract
Author V. C. Mohan
Version 18 oct 2015
Download HistogramAdjust_2_6.zip
Category External filters
License GPLv2
Discussion Doom9 Forum


Contents

[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() 
HistogramAdjust(c,type=3,mclip=mm,mf=26)
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